I have the following code:
public class ApplicationUser : IdentityUser { [StringLength(30, ErrorMessage="First Name should not exceed 30 characters")] [Required(ErrorMessage = "Please enter your First Name")] public string FirstName { get; set; } [StringLength(30, ErrorMessage = "Last Name should not exceed 30 characters")] [Required(ErrorMessage = "Please enter your Last Name")] public string LastName { get; set; } public virtual ICollection<Document> Documents { get; set; } public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return userIdentity; } } public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) { } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } public DbSet<Document> Documents { get; set; } }
public partial class Document { public int DocumentId { get; set; } [MaxLength(2000)] public string DocumentUrl { get; set; } public bool IsReadyForApproval { get; set; } public DateTime CreateTime { get; set; } [DisplayFormat(DataFormatString = "{0:dd-MM-yy}",ApplyFormatInEditMode = true)] public DateTime UpdateTime { get; set; } public Guid CreatorUserId { get; set; } [StringLength(100,ErrorMessage="Title should not exceed 100 characters")] public string Title { get; set; } [StringLength(20)] public string Department { get; set; } [StringLength(20)] public string Complexity { get; set; } public bool IsVerified { get; set; } public virtual ApplicationUser ApplicationUser { get; set; } }
Can anyone provide me an easy solution for this problem?