public Resp_Binary Modify(LayoutDTO model) { var entity = _repository.GetById(model.ID.ToInt()); if (entity.IsNull()) { return new Resp_Binary { message = "未找到对应操作记录,请重新查询数据" } } ; DateTime?dt = null; entity.TriggerType = model.TriggerType; entity.ValideTime = !string.IsNullOrEmpty(model.ValideTime) ? model.ValideTime.ToDateTime() : dt; entity.IsValid = model.IsValid; entity.Degree = model.Degree; entity.Description = model.Description; entity.SysUserId = model.SysUserId.ToInt(); entity.Channel = model.Channel; _repository.Update(entity); if (_repository.UnitOfWork.Commite() > 0) { return(Resp_Binary.Modify_Sucess); } return(Resp_Binary.Modify_Failed); }
public Resp_Binary Add_One(LayoutDTO model) { var record = model.GetPrototype <LayoutDTO, Layout>(); record.IsValid = 1; _repository.Insert(record); if (_repository.UnitOfWork.Commite() > 0) { return(Resp_Binary.Add_Sucess); } return(Resp_Binary.Add_Failed); }