Answer the question
In order to leave comments, you need to log in
Why does this code work?
Hello. I deal with user registration in Core MVC on this lesson . Several points are not very clear:
1) Model validation
When describing the Register() method, there is a line: if(ModelState.IsValid) {...}
As I understand it, this is a field from the inherited Controller class. But how exactly do we check the model for validity if we did not pass it in any of the parameters? How does the class know that it needs to validate the RegisterViewModel from the ViewModels folder?
2) Creating a user
There is a line:
var result = await _userManager.CreateAsync(user, model.Password);
Answer the question
In order to leave comments, you need to log in
Model Validation
User Creation: Beginning , Continued
ASP.Net MVC is a framework. Those. a complete platform for creating applications - typical actions are out of the box. Similarly, people work in php with laravel, Yii2, etc.
But no one forbids you to fence your bike: change the logic of model checking / algorithms for generating, storing, checking password / authorization logic in principle, the logic of the http request pipeline ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question