コード例 #1
0
        public void AddSuccess_Message()
        {
            alerts.AddSuccess("Message", 1);

            Alert actual = alerts.Single();

            Assert.Equal(AlertType.Success, actual.Type);
            Assert.Equal("Message", actual.Message);
            Assert.Equal(1, actual.Timeout);
            Assert.Null(actual.Id);
        }
コード例 #2
0
        public ActionResult Reset(AccountResetView account)
        {
            if (Service.IsLoggedIn(User))
            {
                return(RedirectToDefault());
            }

            if (!Validator.CanReset(account))
            {
                return(RedirectIfAuthorized("Recover"));
            }

            Service.Reset(account);

            Alerts.AddSuccess(Messages.SuccessfulReset, 4000);

            return(RedirectIfAuthorized("Login"));
        }
コード例 #3
0
        public ActionResult Edit([Bind(Exclude = "Id")] ProfileEditView profile)
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectIfAuthorized("Logout", "Auth"));
            }

            if (!Validator.CanEdit(profile))
            {
                return(View(profile));
            }

            Service.Edit(profile);

            Alerts.AddSuccess(Messages.ProfileUpdated, 4000);

            return(RedirectIfAuthorized("Edit"));
        }
コード例 #4
0
        public ActionResult Edit(ProfileEditView profile)
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectToAction("Logout", "Auth"));
            }

            if (!Validator.CanEdit(profile))
            {
                return(View(profile));
            }

            Service.Edit(User, profile);

            Alerts.AddSuccess(Message.For <AccountView>("ProfileUpdated"), 4000);

            return(RedirectToAction("Edit"));
        }
コード例 #5
0
        public ActionResult Reset(AccountResetView account)
        {
            if (Service.IsLoggedIn(User))
            {
                return(RedirectToDefault());
            }

            if (!Validator.CanReset(account))
            {
                return(RedirectToAction(nameof(Recover)));
            }

            Service.Reset(account);

            Alerts.AddSuccess(Message.For <AccountView>("SuccessfulReset"), 4000);

            return(RedirectToAction(nameof(Login)));
        }
コード例 #6
0
ファイル: Profile.cs プロジェクト: mdy6/ToDoApp
        public ActionResult Edit(ProfileEditView profile)
        {
            profile.Id = User.Id();

            if (!Service.IsActive(profile.Id))
            {
                return(RedirectToAction(nameof(Auth.Logout), nameof(Auth)));
            }

            if (!Validator.CanEdit(profile))
            {
                return(View(profile));
            }

            Service.Edit(User, profile);

            Alerts.AddSuccess(Message.For <AccountView>("ProfileUpdated"), 4000);

            return(RedirectToAction(nameof(Edit)));
        }