63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Security.Claims;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNet.Identity;
|
|
using Microsoft.AspNet.Identity.EntityFramework;
|
|
|
|
namespace Church.Net.Entity
|
|
{
|
|
public class FamilyMember : IdentityUser
|
|
{
|
|
public FamilyMember()
|
|
{
|
|
|
|
}
|
|
[StringLength(50)]
|
|
public string FirstName { get; set; }
|
|
[StringLength(50)]
|
|
public string LastName { get; set; }
|
|
public Enumeration.Gender Gender { get; set; }
|
|
|
|
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
|
|
public DateTime Birthday { get; set; }
|
|
public bool Married { get; set; }
|
|
[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public bool Baptized { get; set; }
|
|
public DateTime? DateOfBaptized { get; set; }
|
|
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
|
|
public DateTime DateOfWalkIn { get; set; }
|
|
[StringLength(500)]
|
|
public string Address { get; set; }
|
|
[StringLength(50)]
|
|
public string ComunityAppId { get; set; }
|
|
|
|
[ForeignKey("Career")]
|
|
public string CareerId { get; set; }
|
|
public Career Career { get; set; }
|
|
|
|
public virtual ICollection<PastoralDomainMembers> PastoralDomains { get; set; }
|
|
|
|
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<FamilyMember> manager)
|
|
{
|
|
// 注意 authenticationType 必須符合 CookieAuthenticationOptions.AuthenticationType 中定義的項目
|
|
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
|
|
// 在這裡新增自訂使用者宣告
|
|
return userIdentity;
|
|
}
|
|
|
|
}
|
|
|
|
public class FamilyUserRole : IdentityUserRole<string> { }
|
|
|
|
public class FamilyRole : IdentityRole<string, FamilyUserRole> { }
|
|
|
|
public class FamilyClaim : IdentityUserClaim<string> { }
|
|
|
|
public class FamilyLogin : IdentityUserLogin<string> { }
|
|
}
|