Пример #1
0
        public ActionResult AdminLogin(UserViewModel viewModel)
        {
            var validatedUser = landingPageService.Login(viewModel, true);
            var controller    = ControllerContext.RouteData.Values["controller"].ToString();

            if (validatedUser.UserID == 0 || !validatedUser.UserIsAdmin)
            {
                return(new HttpStatusCodeResult(500));
            }
            if (controller == "Home")
            {
                var user = new Security_User()
                {
                    Id               = validatedUser.UserID,
                    EmailAddress     = validatedUser.EmailAddress,
                    IsEmailConfirmed = validatedUser.IsEmailConfirmed,
                    Guid             = validatedUser.GUID,
                    IsActive         = validatedUser.UserIsActive,
                    IsAdmin          = validatedUser.UserIsAdmin,
                    UserName         = validatedUser.UserName
                };
                var newViewModel = landingPageService.GetAppConfigData(user);
                newViewModel.CurrentUserViewModel = landingPageService.GetCurrentUser(validatedUser.GUID);
                ViewBag.ControllerName            = controller;
                return(PartialView("_ApplicationManager", newViewModel));
            }
            return(RedirectToAction("Index"));
        }