예제 #1
0
        public IActionResult DeleteConfirmed(int id)
        {
            if (!UserIsAdmin())
            {
                return(Error("You need to be logged in as admin to do this."));
            }
            string       _currentUserName = User.Identity.Name;
            ActionObject _actionObject    = _accountActions.DeleteConfirmed(id, _currentUserName);

            if (!_actionObject.Success)
            {
                if (_actionObject.RedirectToError)
                {
                    return(Error(_actionObject.Message));
                }
                else
                {
                    ViewBag.ErrorMessage(_actionObject.Message);
                }
            }
            TempData["success"] = "User (" + _currentUserName + ") was successfully deleted!";
            return(RedirectToAction("Index"));
        }