Пример #1
0
        public ActionResult Delete(object id)
        {
            UserAccessRepository rep = new UserAccessRepository();

            UserAccount userAcc = rep.GetUserAccount((string)id);

            if (userAcc != null)
            {
                if (rep.DeleteUser(userAcc.Username))
                {
                    if (Membership.DeleteUser(userAcc.Username))
                    {
                        ViewData["Message"] = "User account deleted successfully!";
                        userAcc             = null;
                    }

                    else
                    {
                        ViewData["Message"] = "There was an error deleting user account. Please contact your administrator";
                        userAcc             = null;
                    }
                }

                return(View(userAcc));
            }
            else
            {
                ViewData["Message"] = "User could not be found!";
            }


            return(View(userAcc));
        }