示例#1
0
        public ActionResult Delete()
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectToAction("Logout", "Auth"));
            }

            Alerts.AddWarning(Message.For <AccountView>("ProfileDeleteDisclaimer"));

            return(View());
        }
        public ActionResult Delete()
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectIfAuthorized("Logout", "Auth"));
            }

            Alerts.AddWarning(Messages.ProfileDeleteDisclaimer);

            return(View());
        }
示例#3
0
        public void AddWarning_Message()
        {
            alerts.AddWarning("Message", 1);

            Alert actual = alerts.Single();

            Assert.Equal(AlertType.Warning, actual.Type);
            Assert.Equal("Message", actual.Message);
            Assert.Equal(1, actual.Timeout);
            Assert.Null(actual.Id);
        }
示例#4
0
文件: Profile.cs 项目: mdy6/ToDoApp
        public ActionResult Delete()
        {
            if (!Service.IsActive(User.Id()))
            {
                return(RedirectToAction(nameof(Auth.Logout), nameof(Auth)));
            }

            Alerts.AddWarning(Message.For <AccountView>("ProfileDeleteDisclaimer"));

            return(View());
        }
        public ActionResult DeleteConfirmed([Bind(Exclude = "Id")] ProfileDeleteView profile)
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectIfAuthorized("Logout", "Auth"));
            }

            if (!Validator.CanDelete(profile))
            {
                Alerts.AddWarning(Messages.ProfileDeleteDisclaimer);

                return(View());
            }

            Service.Delete(CurrentAccountId);

            return(RedirectIfAuthorized("Logout", "Auth"));
        }
示例#6
0
        public ActionResult DeleteConfirmed(ProfileDeleteView profile)
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectToAction("Logout", "Auth"));
            }

            if (!Validator.CanDelete(profile))
            {
                Alerts.AddWarning(Message.For <AccountView>("ProfileDeleteDisclaimer"));

                return(View());
            }

            Service.Delete(CurrentAccountId);

            Authorization?.Refresh();

            return(RedirectToAction("Logout", "Auth"));
        }
示例#7
0
        public ActionResult DeleteConfirmed(ProfileDeleteView profile)
        {
            if (!Service.IsActive(CurrentAccountId))
            {
                return(RedirectToAction(nameof(Auth.Logout), nameof(Auth)));
            }

            if (!Validator.CanDelete(profile))
            {
                Alerts.AddWarning(Message.For <AccountView>("ProfileDeleteDisclaimer"));

                return(View());
            }

            Service.Delete(CurrentAccountId);

            Authorization.Refresh(HttpContext.RequestServices);

            return(RedirectToAction(nameof(Auth.Logout), nameof(Auth)));
        }