I'm pretty familiar with MVC in PHP where I can pass the values to view from the controller as follows:
public function Index(Users user)
{
return View('index')
->with('user', $user);
}
Or to return validation errors:
public function Index()
{
return View('index')
->withErrors(['Erro1', 'Erro2']);
}
How can I do the same in C #? for example, I have the function that receives the E-mail and Password values of a form, it checks if the user exists and if it does not exist, it returns a variable with the error.
[HttpPost]
public void Attempt(string email, string password, Admins db)
{
Admins admin = db.admins.Where(model => model.email == email).FirstOrDefault();
// return view().with("error", "test1"); ????
}