1

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?

4
  • Which 2 new fields? Commented Feb 2, 2022 at 13:47
  • Hi phuzi, Name = Input.Name, DOB = Input.DOB, Commented Feb 2, 2022 at 13:56
  • Can you show us the implementation of CreateUser Commented Feb 2, 2022 at 14:09
  • There is not.. i do not know how to handle it.. i mean i just need to add two field to the registration form but it looks very hard.. i added them in the view inside the code register.cs but i do not know how to save them when the var user = CreateUser(); is called... have you got a simpre example ho to implement in NET 6 ? thanks Commented Feb 2, 2022 at 15:49

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.