public static JqGridResponse Delete(EditMemberManagementVM model, ProviderCurrentMember currentMember) { JqGridResponse aResponse = new JqGridResponse(); ProviderMember aMember = new ProviderMember(model.Id); if (currentMember.CanEdit(aMember)) { if (aMember.Delete()) { aResponse.Success = true; } else { aResponse.Success = false; aResponse.Message = ErrorStrings.OPERATION_FAILED; } } else { aResponse.Success = false; aResponse.Message = ErrorStrings.OPERATION_NO_RIGHTS; } return aResponse; }
// POST: /member/delete public virtual ActionResult Delete(string key) { MessageVM returnMessageVM; ProviderIssuedKey issuedKey = new ProviderIssuedKey(); if (issuedKey.Load(key) && !issuedKey.HasExpired && issuedKey.IsValidated) { ProviderMember aMember = new ProviderMember(issuedKey.MemberId); ProviderCurrentMember currentMember = ProviderCurrentMember.Instance; // if the person is currently logged on with the account that is being deleted then log them off if (currentMember.Id == aMember.Id) { currentMember.LogOff(); } aMember.Delete(); returnMessageVM = new MessageVM { Image = ImageLibrary.Success, CssClassContainer = "success", Message = "Success! Member Acount deleted.", Title = "Acount Deleted", LinkText = "Continue", LinkHref = Url.Action(MVC.Home.Index()) }; } else { returnMessageVM = new MessageVM { Image = ImageLibrary.Alert, CssClassContainer = "failure", Message = "Failed to delete member account. Please <a href=\"" + Url.Action(MVC.Info.ContactUs()) + "\">contact us</a> to resolve the issue.", Title = "Account Deletion Failure", LinkText = "Continue", LinkHref = Url.Action( MVC.Home.Index() ) }; } return View("Message", returnMessageVM); }
public static void Delete(long id) { ProviderMember aMember = new ProviderMember(id); aMember.Delete(); }