public IActionResult Login_Post(LoginModel loginModel) { if (!ModelState.IsValid) { return(View("Login", loginModel)); } var loginResult = _accessRepository.Login(loginModel.EmailAddress, loginModel.Password); if (loginResult) { return(RedirectToAction("Logged")); } ViewData["ErrorMessage"] = "Invalid credentials"; return(View("Login")); }