public ActionResult SubmitForm(TbHoistingSafety model, string type) { try { if (type == "add") { var data = _hoistSafetyLogic.Insert(model); return(Content(data.ToJson())); } else { var data = _hoistSafetyLogic.Update(model); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
/// <summary> /// 修改数据 /// </summary> public AjaxResult Update(TbHoistingSafety model) { if (model == null) { return(AjaxResult.Warning("参数错误")); } try { var count = Repository <TbHoistingSafety> .Update(model, p => p.ID == model.ID); if (count > 0) { return(AjaxResult.Success()); } return(AjaxResult.Error("操作失败")); } catch (Exception ex) { return(AjaxResult.Error(ex.ToString())); } }
/// <summary> /// 新增数据 /// </summary> public AjaxResult Insert(TbHoistingSafety model) { if (model == null) { return(AjaxResult.Warning("参数错误")); } try { model.Examinestatus = "未发起"; model.InsertUserCode = OperatorProvider.Provider.CurrentUser.UserCode; var count = Repository <TbHoistingSafety> .Insert(model); if (count > 0) { return(AjaxResult.Success()); } return(AjaxResult.Error("操作失败")); } catch (Exception ex) { return(AjaxResult.Error(ex.ToString())); } }