/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Edit(SymptomRecord model) { if (model == null) { return(false); } using (SymptomRecordDAL dal = new SymptomRecordDAL()) { CTMS_SYMPTOMRECORDS entitys = ModelToEntity(model); return(dal.Edit(entitys)); } }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(SymptomRecord model) { if (model == null) { return(string.Empty); } using (SymptomRecordDAL dal = new SymptomRecordDAL()) { CTMS_SYMPTOMRECORDS entity = ModelToEntity(model); entity.ID = string.IsNullOrEmpty(model.ID) ? Guid.NewGuid().ToString() : model.ID; return(dal.Add(entity)); } }
/// <summary> /// Entity转Model /// </summary> /// <param name="entity"></param> /// <returns></returns> private SymptomRecord EntityToModel(CTMS_SYMPTOMRECORDS entity) { if (entity != null) { var model = new SymptomRecord() { ID = entity.ID, SymptomId = entity.SYMPTOMID, UserId = entity.USERID, SymptomLevel = entity.SYMPTOMLEVEL, DictSymLevelId = entity.DICTSYMLEVELID, SymptomDate = entity.SYSMPTOMDATE, CreateDate = entity.CREATEDATE, EditDate = entity.EDITDATE }; return(model); } return(null); }
/// <summary> /// Model转Entity /// </summary> /// <param name="model"></param> /// <returns></returns> private CTMS_SYMPTOMRECORDS ModelToEntity(SymptomRecord model) { if (model != null) { var entity = new CTMS_SYMPTOMRECORDS() { ID = model.ID, SYMPTOMID = model.SymptomId, USERID = model.UserId, SYMPTOMLEVEL = model.SymptomLevel, DICTSYMLEVELID = model.DictSymLevelId, SYSMPTOMDATE = model.SymptomDate, CREATEDATE = model.CreateDate, EDITDATE = model.EditDate }; return(entity); } return(null); }