Tamil Cantroz
Tamil Cantroz

Reputation: 145

Add custom field in .NET 6 Microsoft tutorial

I'm trying to follow this tutorial on the Microsoft website.

I am using Visual Studio Express 2020 and .NET 6 Web MVC, I followed the instructions and all look ok till this line:

var user = new CateringMilanoUser
            {
                Name = Input.Name,
                DOB = Input.DOB,
                UserName = Input.Email,
                Email = Input.Email
            };

When I generated the code with visual studio I found it different :

var user = CreateUser();

Do you know how to implement the CreateUser with those two new fiedls?

Upvotes: 1

Views: 395

Answers (1)

Zee
Zee

Reputation: 642

You can set values before calling the CreateAsync Method.

var user = CreateUser();

user.DOB = Input.DOB;
user.Name = Input.Name;

var result = await _userManager.CreateAsync(user, Input.Password);

Upvotes: 1

Related Questions