public IActionResult Login(UserViewModel model) { UserViewModel user = _authService.GetLoginUser(model.UserName.Trim(), _encryptionUtil.EncodeSHA1(model.Password)); try { if (user == null) { ModelState.AddModelError("", "UserName or Password not exist"); return(View("Login", user)); } _ = CreateAuthenticationTicket(user); return(user.Role.ToUpper() switch { Role.Admin => RedirectToAction("Index", "User", new { Area = "Admin" }), //Role.Editor => RedirectToAction("Index", "Dashboard", new { Area = "Editor" }), //Role.Sales => RedirectToAction("Index", "Dashboard", new { Area = "Sales" }), //Role.Client => RedirectToAction("Index", "Dashboard", new { Area = "Client" }), //Role.Manager => RedirectToAction("Index", "Dashboard", new { Area = "Manager" }), _ => View("Login", user), }); }