public bool UpdateExamineTemplateItemOptions(ExamineTemplateItemOptions model) { CTMS_ADM_EXAMINEITEMOPTIONS entity = LoadEntityFromModel(model); bool result = Update(entity); return(result); }
/// <summary> /// 更新对象 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateExamineTemplateItemOptions(ExamineTemplateItemOptions model) { using (EFExamineTemplateItemOptionsRepository _rsp = new EFExamineTemplateItemOptionsRepository()) { return(_rsp.UpdateExamineTemplateItemOptions(model)); } }
public IHttpActionResult Post([FromBody] Request <ExamineTemplateItemOptions> req) { Response <ExamineTemplateItemOptions> rsp = new Response <ExamineTemplateItemOptions>(); try { UserInfo user = _user.GetCurrentUser(); if (user == null) { return(base.Redirect("/User/Login#/Login")); } ExamineTemplateItemOptions et = req.Data as ExamineTemplateItemOptions; bool result = false; if (string.IsNullOrEmpty(et.Id)) { ExamineTemplateItemOptions model = new ExamineTemplateItemOptions(); string id = Guid.NewGuid().ToString(); model.Id = id; model.Description = et.Description; model.ExamineItemId = et.ExamineItemId; model.CreateUserId = user.UserId; model.CreateUserName = user.LoginName; model.CreateDateTime = DateTime.Now; model.EditUserId = user.UserId; model.EditUserName = user.LoginName; model.EditDateTime = DateTime.Now; model.IsDeleted = 0; result = _etio.AddExamineTemplateItemOptions(model); rsp.Data = model; } else { et.EditUserId = user.UserId; et.EditUserName = user.LoginName; et.EditDateTime = DateTime.Now; result = _etio.UpdateExamineTemplateItemOptions(et); rsp.Data = et; } if (!result) { return(BadRequest("操作失败")); } return(Ok(rsp)); } catch (Exception ex) { LogService.WriteErrorLog("ExamineItemOptionController[Post]", ex.ToString()); return(BadRequest(ex.Message)); } }
/// <summary> /// 获取数据 /// </summary> /// <param name="id"></param> /// <returns></returns> public ExamineTemplateItemOptions GetExamineTemplateItemOptionsById(string id) { using (EFExamineTemplateItemOptionsRepository _rsp = new EFExamineTemplateItemOptionsRepository()) { ExamineTemplateItemOptions etio = _rsp.GetExamineTemplateItemOptionsById(id); if (etio != null) { ExamineTemplateItems model = _eti.GetExamineTemplateItemsById(etio.ExamineItemId); etio.ExamineItemName = model.Name; } return(etio); } }
protected ExamineTemplateItemOptions LoadModelFromEntity(CTMS_ADM_EXAMINEITEMOPTIONS entity) { if (entity == null) { return(null); } ExamineTemplateItemOptions model = new ExamineTemplateItemOptions(); model.Id = entity.ID; model.ExamineItemId = entity.EXAMINEITEMID; model.Description = entity.DESCRIPTION; model.CreateUserId = entity.CREATEUSERID; model.CreateUserName = entity.CREATEUSERNAME; model.CreateDateTime = (DateTime)entity.CREATEDATETIME; model.EditUserId = entity.EDITUSERID; model.EditUserName = entity.EDITUSERNAME; model.EditDateTime = (DateTime)entity.EDITDATETIME; model.IsDeleted = (int)entity.ISDELETED; return(model); }
protected CTMS_ADM_EXAMINEITEMOPTIONS LoadEntityFromModel(ExamineTemplateItemOptions model) { if (model == null) { return(null); } CTMS_ADM_EXAMINEITEMOPTIONS entity = new CTMS_ADM_EXAMINEITEMOPTIONS(); entity.ID = model.Id; entity.EXAMINEITEMID = model.ExamineItemId; entity.DESCRIPTION = model.Description; entity.CREATEUSERID = model.CreateUserId; entity.CREATEUSERNAME = model.CreateUserName; entity.CREATEDATETIME = model.CreateDateTime; entity.EDITUSERID = model.EditUserId; entity.EDITUSERNAME = model.EditUserName; entity.EDITDATETIME = model.EditDateTime; entity.ISDELETED = model.IsDeleted; return(entity); }