Ejemplo n.º 1
0
        public ActionResult Delete(string Password)
        {
            var pub = PubDAO.Search(UserSession.ReturnPubId(null));

            if (Password == pub.Password)
            {
                PubDAO.Delete(pub);
                UserSession.ClearPubSession();
                return(RedirectToAction("Login"));
            }
            else
            {
                ViewBags();
                ModelState.AddModelError("", "Error - Password does not match");
                return(View("Account", pub));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Delete(string password)
        {
            var returnedPub = PubDAO.Search(UserSession.ReturnPubId(null));

            if (returnedPub == null)
            {
                return(RedirectToAction("Logout", "User"));
            }
            var returnedUser = UserDAO.Search(returnedPub.UserId);

            if (password != returnedUser.Password)
            {
                ModelState.AddModelError("", "Error - Password does not match");
                return(View("Account"));
            }

            PubDAO.Delete(returnedPub);
            UserDAO.Delete(returnedUser);

            return(RedirectToAction("Logout", "User"));
        }