Nighil
Nighil

Reputation: 4129

How can i add custom field in user registration asp.net boilerplate

I am using aspnet boilerplate template. In that inbuilt registration consist for some default fields only. How can i add new custom fields, so that when user registers they want to enter that also?

public class User : AbpUser<User>

if i create a attribute in this class it will work?

Upvotes: 0

Views: 2110

Answers (1)

aaron
aaron

Reputation: 43073

Follow these steps:

For .NET Core 2.0 + Angular

  1. Create a property in User.
  2. Add the property in RegisterInput.
  3. Add the form field in register.component.html.
  4. Bind the property in AccountAppService's Register method:

    user.MyProperty = input.MyProperty;
    

For .NET Core 2.0 + MVC

  1. Create a property in User.
  2. Add the property in RegisterViewModel.
  3. Add the form field in Register.cshtml.
  4. Bind the property in AccountController's Register method:

    user.MyProperty = model.MyProperty;
    

Upvotes: 3

Related Questions