public Task <int> SubmitForm <TDto>(InfectionEntity entity, TDto dto) where TDto : class { if (!string.IsNullOrEmpty(entity.F_Id)) { entity.Modify(entity.F_Id); entity.F_LastModifyUserId = _usersService.GetCurrentUserId(); return(_service.UpdateAsync(entity, dto)); } else { entity.Create(); entity.F_CreatorUserId = _usersService.GetCurrentUserId(); return(_service.InsertAsync(entity)); } }
public IActionResult SubmitData([FromBody] SubmitDataInput input) { var userId = _usersService.GetCurrentUserId(); InfectionEntity entity = null; if (string.IsNullOrEmpty(input.id))//新建 { entity = new InfectionEntity { F_Id = Common.GuId(), F_RecordPerson = userId, F_CreatorTime = DateTime.Now, F_CreatorUserId = userId, F_EnabledMark = true }; } else//修改 { entity = new InfectionEntity { F_Id = input.id, F_LastModifyTime = DateTime.Now, F_LastModifyUserId = userId }; } entity.F_Item1 = input.item1; entity.F_Item2 = input.item2; entity.F_Item3 = input.item3; entity.F_Item4 = input.item4; entity.F_Item5 = input.item5; entity.F_Item6 = input.item6; entity.F_Item7 = input.item7; if (string.IsNullOrEmpty(input.id)) { _infectionApp.InsertForm(entity); } else { _infectionApp.UpdateForm(entity); } var data = new { id = entity.F_Id }; return(Ok(data)); }
public Task <int> InsertForm(InfectionEntity entity) { return(_service.InsertAsync(entity)); }
public Task <int> UpdateForm(InfectionEntity entity) { return(_service.UpdatePartialAsync(entity)); }