public virtual ActionResult Add(RequestData data) { PostResult result = new PostResult(); string valRet = this.BeforeSave(ActionType.Add, data); if (valRet == "") { bool ret = this.DoAdd(data); if (ret == true) { result.Success = true; result.Data = "1"; result.Message = Lang.add_success; this.AfterSave(ActionType.Add, data); } else { result.Success = false; result.Data = "0"; result.Message = Lang.add_failure; } } else { result.Success = false; result.Data = "0"; result.Message = valRet; } result.ExtendData = OperateReturnData; return(Json(result)); }
public virtual ActionResult Delete(RequestData data) { PostResult result = new PostResult(); string valRet = this.BeforeSave(ActionType.Delete, data); if (valRet == "") { bool ret = this.DoDelete(data); if (ret == true) { result.Success = true; result.Data = "1"; result.Message = Lang.del_success; this.AfterSave(ActionType.Delete, data); } else { result.Success = false; result.Data = "0"; result.Message = Lang.del_failure; } } else { result.Success = false; result.Data = "0"; result.Message = valRet; } return(Json(result)); }
/// <summary> /// 拼装AJAX返回JSON数据 /// author:liwu 2018-01-08 /// </summary> /// <param name="Msg"></param> /// <param name="data"></param> /// <returns></returns> protected JsonResult SuccessResult(string Msg, object data) { PostResult result = new PostResult(); result.Success = true; result.Message = Msg; result.Data = data; return(Json(result)); }
/// <summary> /// 拼装AJAX返回JSON数据 /// author:liwu 2018-01-08 /// </summary> /// <param name="errorMsg"></param> /// <returns></returns> protected JsonResult ErrorResult(string errorMsg) { PostResult result = new PostResult(); result.Success = false; result.Message = errorMsg; result.Data = ""; return(Json(result)); }