-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Moesif/add-apim-users
Added Apim User. increment version to 2.0.2
- Loading branch information
Showing
5 changed files
with
184 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using Newtonsoft.Json; | ||
|
||
namespace Moesif.Api.Models | ||
{ | ||
public class ContextModel : INotifyPropertyChanged | ||
{ | ||
private ContextUserModel user; | ||
|
||
[JsonProperty("user")] | ||
public ContextUserModel User | ||
{ | ||
get | ||
{ | ||
return this.user; | ||
} | ||
set | ||
{ | ||
this.user = value; | ||
onPropertyChanged("User"); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Property changed event for observer pattern | ||
/// </summary> | ||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
/// <summary> | ||
/// Raises event when a property is changed | ||
/// </summary> | ||
/// <param name="propertyName">Name of the changed property</param> | ||
protected void onPropertyChanged(String propertyName) | ||
{ | ||
if (PropertyChanged != null) | ||
{ | ||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
} | ||
|
||
} | ||
|
||
public class ContextUserModel : INotifyPropertyChanged | ||
{ | ||
private String id; | ||
private String email; | ||
private String firstName; | ||
private String lastName; | ||
|
||
[JsonProperty("Id")] | ||
public String Id | ||
{ | ||
get | ||
{ | ||
return this.id; | ||
} | ||
set | ||
{ | ||
this.id = value; | ||
onPropertyChanged("Id"); | ||
} | ||
} | ||
|
||
[JsonProperty("Email")] | ||
public String Email | ||
{ | ||
get | ||
{ | ||
return this.email; | ||
} | ||
set | ||
{ | ||
this.email = value; | ||
onPropertyChanged("Email"); | ||
} | ||
} | ||
|
||
[JsonProperty("FirstName")] | ||
public String FirstName | ||
{ | ||
get | ||
{ | ||
return this.firstName; | ||
} | ||
set | ||
{ | ||
this.firstName = value; | ||
onPropertyChanged("FirstName"); | ||
} | ||
} | ||
[JsonProperty("LastName")] | ||
public String LastName | ||
{ | ||
get | ||
{ | ||
return this.lastName; | ||
} | ||
set | ||
{ | ||
this.lastName = value; | ||
onPropertyChanged("LastName"); | ||
} | ||
} | ||
/// <summary> | ||
/// Property changed event for observer pattern | ||
/// </summary> | ||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
/// <summary> | ||
/// Raises event when a property is changed | ||
/// </summary> | ||
/// <param name="propertyName">Name of the changed property</param> | ||
protected void onPropertyChanged(String propertyName) | ||
{ | ||
if (PropertyChanged != null) | ||
{ | ||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
} | ||
|
||
public static ContextUserModel deserialize(String jsonStr) | ||
{ | ||
ContextUserModel m = null; | ||
if (!string.IsNullOrWhiteSpace(jsonStr)) | ||
m = JsonConvert.DeserializeObject<ContextUserModel>(jsonStr.Trim()); | ||
return m; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters