5
I’m quite used to PHP MVC where I can pass the values to the 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 own the function that receives the E-mail and Password values of a form, checks if the user exists and if it does not exist, 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"); ????
}