1

How should I update custom made identity fields in ASP.NET MVC?

public class ApplicationUser : IdentityUser
{
    public string customerName { get; set; }
    public string customer_lastName { get; set; }
    public string customer_phoneNumber { get; set; }

    public string addressType { get; set; }
    public string addressLine1 { get; set; }
    public string addressLine2 { get; set; }
    public string city { get; set; }
    public string country { get; set; }
    public string[] location_details { 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();
    }
}

To be more specific, how am I supposed to update fields such as customerName,or customer_lastName after a value has been inserted in database for that field ?

Jackdaw
  • 7,626
  • 5
  • 15
  • 33
Andrei
  • 11
  • 1

0 Answers0