public async Task <ActionResult> Login(LoginModel model) { User user = null; if (ModelState.IsValid) { user = await _dbContext.GetUserAsync(model); if (user == null) { ModelState.AddModelError("", "Email or Password is wrong! Try again!"); return(View()); } else { Session.Add("user", user.Id); return(RedirectToAction("Index", "Dashboard")); } } return(View()); }