Why this code works?

Hi all. Handle user registration in MVC at the Core of this lesson. Not very clear on few points:
1) validation of the model
In the description of the Register() method there is a line:
if(ModelState.IsValid) {...}
As I understand it, this field is inherited from Controller class. But how exactly do we check the model for validity, if we don't pass it any parameters? Where the class knows that he needs to validate the model RegisterViewModel from the folder ViewModels?

2) Create user
There is a line:
var result = await _userManager.CreateAsync(user, model.Password);

Do I understand correctly that all of the logic for hashing, adding salt, etc. assume the creators of the Core MVC? Just in node.js this is usually done handles.
June 8th 19 at 17:26
2 answers
June 8th 19 at 17:28
Solution
Validation of the model
User creation: the beginning, continued
all of the logic for hashing, adding salt, etc. assume the creators of the Core MVC?

ASP.Net MVC is a framework. Ie full-fledged platform for building applications, a typical action is "out of the box". Similarly, people working in php with laravel, Yii2, etc.
But no one forbids you to fence your bike: change the logic for the validation of models/algorithms for generating, storing, password authentication/authorization logic basically, the logic in the pipeline of http requests...
June 8th 19 at 17:30
Solution
1. Put breakpoint in the controller and view this.Request.Query, there will be all the parameters that came in the controller so they can be in the Body. That's what is needed and FromBody attributes FromRequest to more accurately specify where MapIT values on the model. After he sparsit and smaet values in the model, if there is a check, it will take the attributes and it already checks for validity.

2. You understand correctly. All this is implemented in the identity.

Find more questions by tags C#.NET