Exemplo n.º 1
0
        public virtual async Task <ActionResult> Delete(string loginProvider, DeleteRemoteMembership command)
        {
            if (command == null)
            {
                return(View(MVC.Errors.Views.BadRequest));
            }

            string alert;

            if (!ModelState.IsValid)
            {
                var validationResult = _validation.Validate(command);
                alert = string.Format("There was an error removing your **{0}** login: {1}",
                                      command.LoginProvider, validationResult.Errors
                                      .First(x => !string.IsNullOrWhiteSpace(x.ErrorMessage)).ErrorMessage);
                TempData.Alerts(alert, AlertFlavor.Danger);
                return(RedirectToAction(await MVC.UserLogins.Index()));
            }

            await _commands.Execute(command);

            alert = string.Format("Your **{0}** login was removed successfully.", command.LoginProvider);
            TempData.Alerts(alert, AlertFlavor.Success, true);
            return(RedirectToAction(await MVC.UserLogins.Index()));
        }
Exemplo n.º 2
0
        public virtual async Task<ActionResult> Delete(string loginProvider, DeleteRemoteMembership command)
        {
            if (command == null) return View(MVC.Errors.Views.BadRequest);

            string alert;
            if (!ModelState.IsValid)
            {
                var validationResult = _validation.Validate(command);
                alert = string.Format("There was an error removing your **{0}** login: {1}",
                    command.LoginProvider, validationResult.Errors
                        .First(x => !string.IsNullOrWhiteSpace(x.ErrorMessage)).ErrorMessage);
                TempData.Alerts(alert, AlertFlavor.Danger);
                return RedirectToAction(await MVC.UserLogins.Index());
            }

            await _commands.Execute(command);
            alert = string.Format("Your **{0}** login was removed successfully.", command.LoginProvider);
            TempData.Alerts(alert, AlertFlavor.Success, true);
            return RedirectToAction(await MVC.UserLogins.Index());
        }