public ActionResult LogIn(UserViewModel userModel) { var result = _accountComponent.CheckLogin(userModel); if (result == null) { ModelState.AddModelError("", "User name or password is incorrect."); return(View("LogIn")); } else { Session["UserDetail"] = result; GetAllPermissions(result.Role); FormsAuthentication.SetAuthCookie(new JavaScriptSerializer().Serialize(result), false); if (result.Role == Convert.ToInt32(EnumUtility.Role.Admin)) { return(RedirectToAction("Customer", "Customer")); } else { return(RedirectToAction("Customer", "Customer")); } } }