Exemple #1
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            ActionResult result;

            if (ModelState.IsValid && model.Login())
            {
                if (User.IsInRole("admin"))
                {
                    result = RedirectToAction("Management");
                }

                UsersManagementService.UpdateLastLoginDate(model.UserName);

                result = _RedirectToLocal(returnUrl);
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Имя пользователя или пароль не являются корректными");

                result = View(model);
            }

            return(result);
        }