コード例 #1
0
        public ActionResult Registration(User user)
        {
            //if (SessionAccount.GetId() != null) return Redirect(HomeIndex);
            var message = "";

            user = _dataManager.UserManager.Register(user.Fio, user.Login, user.Password, ref message);
            if (user == null)
            {
                ViewBag.Message = message;
                return(View());
            }

            SessionAccount.AuthenticateAccount(user);
            TempData["sAlertMessage"] = $"Добро пожаловать, {SessionAccount.GetFio()}!";
            return(Redirect("/Account/ProfilePerson"));
        }
コード例 #2
0
        public ActionResult Login(User user)
        {
            //if (SessionAccount.GetId() == null) return Redirect(HomeIndex);
            user = _dataManager.UserManager.Authenticate(user.Login, user.Password);
            if (user != null)
            {
                SessionAccount.AuthenticateAccount(user);

                ViewBag.Message =
                    $"Добро пожаловать, {SessionAccount.GetFio()}!";

                return(Redirect(DistributionPage));
            }

            ViewBag.Message = "Не верный логин или пароль";
            return(View());
        }