/// <summary> /// 创建一个hr_srv_history /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个hr_srv_history</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, hr_srv_history entity) { try { repository.Create(entity); return(true); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }
public ActionResult _Insert_Edit(hr_srv_history item) { hr_srv_history historyDAL = new hr_srv_history(); //更新数据 if (TryUpdateModel(historyDAL)) { if (item.id == 0) { _historyBLL.Create(ref validationErrors, historyDAL); } else { _historyBLL.Edit(ref validationErrors, historyDAL); } } NameValueCollection collection = new NameValueCollection(Request.QueryString); IEnumerable <hr_srv_history> history = _historyBLL.Bindhistory1(collection); return(View(new GridModel(history))); }