public async Task <DisasterDto> InertDisaster() { try { DisasterDto disasterDtoRtn = new DisasterDto(); for (int i = 0; i < 100; i++) { DisasterDto disasterDto = new DisasterDto(); disasterDto.DISASTERNAME = "滑坡"; disasterDto.IsDeleted = false; disasterDto.AREARIGHTCODE = "420010"; disasterDto.OCCURTIME = DateTime.Now; disasterDto.POSITION = "湖北武汉洪山区"; Mapper.CreateMap <DisasterEntity, DisasterDto>(); DisasterEntity disasterEntity = Mapper.DynamicMap <DisasterDto, DisasterEntity>(disasterDto); DisasterEntity entity = await _iDisasterRepository.InsertAsync(disasterEntity); disasterDtoRtn = Mapper.Map <DisasterDto>(entity); } return(disasterDtoRtn); } catch (Exception exception) { throw exception; } }
/// <summary> /// 修改数据 /// </summary> /// <param name="disasterDto"></param> /// <returns></returns> public async Task <DisasterDto> Update(DisasterInput input) { try { DisasterEntity disasterEntity = new DisasterEntity { Id = input.Id, DISASTERNAME = input.DISASTERNAME, OCCURTIME = input.OCCURTIME, POSITION = input.POSITION, REMARK = input.REMARK, AREARIGHTCODE = input.AREARIGHTCODE, IsDeleted = false }; DisasterEntity entity = _iDisasterRepository.Update(disasterEntity); DisasterDto disasterDtoRtn = entity.MapTo <DisasterDto>(); return(disasterDtoRtn); } catch (Exception exception) { throw exception; } }