Migrating to modern c# namespace
Using the short namesapce declaration for conciseness
This commit is contained in:
+44
-45
@@ -5,53 +5,52 @@ using System.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Icarus.Models
|
||||
namespace Icarus.Models;
|
||||
|
||||
[Table("User")]
|
||||
public class User
|
||||
{
|
||||
[Table("User")]
|
||||
public class User
|
||||
#region Properties
|
||||
[JsonProperty("user_id")]
|
||||
[Column("UserID")]
|
||||
[Key]
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("password")]
|
||||
public string Password { get; set; }
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
[JsonProperty("phone")]
|
||||
[Column("Phone")]
|
||||
public string Phone { get; set; }
|
||||
[JsonProperty("firstname")]
|
||||
public string Firstname { get; set; }
|
||||
[JsonProperty("lastname")]
|
||||
public string Lastname { get; set; }
|
||||
[JsonProperty("email_verified")]
|
||||
[NotMapped]
|
||||
public bool EmailVerified { get; set; }
|
||||
[JsonProperty("date_created")]
|
||||
public DateTime DateCreated { get; set; }
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
[JsonProperty("last_login")]
|
||||
public DateTime? LastLogin { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public System.Collections.Generic.IEnumerable<string> Roles { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
public System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims()
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("user_id")]
|
||||
[Column("UserID")]
|
||||
[Key]
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("password")]
|
||||
public string Password { get; set; }
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
[JsonProperty("phone")]
|
||||
[Column("Phone")]
|
||||
public string Phone { get; set; }
|
||||
[JsonProperty("firstname")]
|
||||
public string Firstname { get; set; }
|
||||
[JsonProperty("lastname")]
|
||||
public string Lastname { get; set; }
|
||||
[JsonProperty("email_verified")]
|
||||
[NotMapped]
|
||||
public bool EmailVerified { get; set; }
|
||||
[JsonProperty("date_created")]
|
||||
public DateTime DateCreated { get; set; }
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
[JsonProperty("last_login")]
|
||||
public DateTime? LastLogin { get; set; }
|
||||
var claims = new System.Collections.Generic.List<System.Security.Claims.Claim> { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, Username) };
|
||||
claims.AddRange(Roles.Select(role => new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role)));
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public System.Collections.Generic.IEnumerable<string> Roles { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
public System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims()
|
||||
{
|
||||
var claims = new System.Collections.Generic.List<System.Security.Claims.Claim> { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, Username) };
|
||||
claims.AddRange(Roles.Select(role => new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role)));
|
||||
|
||||
return claims;
|
||||
}
|
||||
#endregion
|
||||
return claims;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user