public static JqGridResponse Edit(EditMemberManagementVM model, ProviderCurrentMember currentMember) { JqGridResponse aResponse = new JqGridResponse(); ProviderMember aMember = new ProviderMember(model.Id); if (currentMember.CanEdit(aMember)) { aMember.IsArticleAdmin = model.IsArticleAdmin; aMember.IsBanned = model.IsBanned; aMember.IsCategoryAdmin = model.IsCategoryAdmin; aMember.IsMasterAdmin = model.IsMasterAdmin; aMember.IsMemberAdmin = model.IsMemberAdmin; aMember.IsSuperAdmin = model.IsSuperAdmin; try { aMember.Save(); aResponse.Success = true; } catch (Exception caughtException) { aResponse.Success = false; aResponse.Message = ErrorStrings.OPERATION_FAILED; } } else { aResponse.Success = false; aResponse.Message = ErrorStrings.OPERATION_NO_RIGHTS; } return aResponse; }
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; }
public virtual JsonResult _EditJqGridMember(EditMemberManagementVM model) { JqGridResponse aResponse; if (ModelState.IsValid) { try { aResponse = MemberBL.Process(model, ProviderCurrentMember.Instance); } catch (Exception caughtException) { // DO NOT LOG THIS aResponse = new JqGridResponse(); aResponse.Success = false; aResponse.Message = caughtException.ToString(); } } else { aResponse = new JqGridResponse(); aResponse.Success = false; aResponse.Message = ErrorStrings.INVALID_INPUT; } return Json(aResponse); }
public static JqGridResponse Process(EditMemberManagementVM model, ProviderCurrentMember currentMember) { JqGridResponse aResponse; if (model.Oper.CompareTo("edit") == 0) { aResponse = Edit(model, currentMember); } else if (model.Oper.CompareTo("del") == 0) { aResponse = Delete(model, currentMember); } else { aResponse = new JqGridResponse(); aResponse.Success = false; aResponse.Message = ErrorStrings.OPERATION_UNKNOWN(model.Oper); } return aResponse; }