Question Adding user profile in a database table extending from aspnetuser

thgtang

New member
Joined
Nov 13, 2019
Messages
4
Programming Experience
1-3
Hi,

I am learning to make a user profile page for filling additional information from user registration.

In aspnetuser, it has already got some fields like email, password and phone no. I have created another table called UserProfile that has gender, address, user role and other personal information. It's supposed that user could update these information after user registration.

I have done the following coding so far but I have no idea how to do the next step.... and I would like to get some advices on this. Thanks!

Models\ApplicationUser

C#:
  public class ApplicationUser : IdentityUser
    {
        public virtual UserProfile UserProfile{get; set;}

    }
Models\UserProfile
C#:
public partial class UserProfile
    {

        public long UserId { get; set; }
        [Required(ErrorMessage="ErrMsgMissingLastName"), MaxLength(50)]
        [Display(Name = "LbLastName")]
        public string LastName { get; set; }
        [Required(ErrorMessage = "ErrMsgMissingFirstName"), MaxLength(50)]
        [Display(Name = "LbFirstName")]
        public string FirstName { get; set; }
        
        [Required(ErrorMessage = "ErrMsgMissingDOB")]
        [Display(Name="LbDOB")]
        public DateTime Dob { get; set; }

        [Required(ErrorMessage = "ErrMsgMissingGender")]
        [Display(Name ="LbGender")]
        public string Gender { get; set; }
        [Required(ErrorMessage = "ErrMsgMissingMobileNo")]
        [Display(Name ="LbMobileNo")]
        public string MobileNo { get; set; }
        
        [Display(Name ="LbHomeNo")]
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
644
Location
Virginia Beach, VA
Programming Experience
10+
Top Bottom