public AccountEditArticleVM() { _jqGridEdit = new JqGridEditArticleVM(); }
public virtual JsonResult _EditJqGridArticle(JqGridEditArticleVM model) { JqGridResponse aResponse; if ( ModelState.IsValid ) { try { aResponse = ArticleBL.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(JqGridEditArticleVM 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; }
public static JqGridResponse Delete(JqGridEditArticleVM model, ProviderCurrentMember currrentMember) { JqGridResponse aResponse = new JqGridResponse(); ProviderArticle anArticle = new ProviderArticle(model.Id); if (currrentMember.CanEdit(anArticle)) { if (anArticle.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 static JqGridResponse Edit(JqGridEditArticleVM model, ProviderCurrentMember currentMember) { JqGridResponse aResponse = new JqGridResponse(); ProviderArticle anArticle = new ProviderArticle(model.Id); if (currentMember.CanEdit(anArticle)) { anArticle.IgnoreFlags = model.IgnoreFlags; anArticle.IsHidden = model.IsHidden; anArticle.IsPublished = model.IsPublished; try { anArticle.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; }