public ActionResult DeleteAccount(DeleteAccountModel model) { if (Profile.IsAuthenticated) { //send to email model.Description; var curUser = Profile.CurrentUser; // Profile.UserService.SignOut(); Profile.UserService.DeleteUserFromContext(curUser.Id); Profile.UserService.DeleteCurrentUser(curUser); return RedirectToAction("Login", new UserLoginModel(Profile)); } return RedirectToAction("Registration", new RegistrationModel()); }
public ActionResult DeleteUser(DeleteAccountModel model) { if (Profile.IsAuthenticated) { var curUser = Profile.CurrentUser; if (!string.IsNullOrEmpty(curUser.PasswordHash)) { if (!Profile.VerifiedPassword(model.Password)) { var regModel = new RegistrationModel(Profile.CurrentUser); regModel.IsConfirmationPasswordInCorrect = true; Session["regModel"] = regModel; return RedirectToAction("Registration"); } } Profile.UserService.DeleteUserFromContext(curUser.Id); Profile.UserService.DeleteCurrentUser(curUser); //SendDeleteAccountEmail(model.Description, curUser); } return RedirectToAction("Login", new UserLoginModel(Profile)); }