public async Task <GenericResult <int> > AddPopulationInfo(PopulationInformationDto informationDto) { try { var mappedEntity = _mapper.Map <PopulationInformation>(informationDto); var newPopulation = await _populationRepo.InsertAsync(mappedEntity); return(GenericResult <int> .Success(newPopulation.ID)); } catch (Exception e) { return(GenericResult <int> .Error(e)); } }
public async Task <GenericResult <int> > AddPopulationInfo(PopulationInformationDto informationDto) => await RequestGenericResultReturnsEndPointAsync <int>((HttpClient client) => { return(client.PostAsync(_serviceInformations.PopulationInformationService.BaseUrl + "/api/PopulationInformation/AddNew", new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(informationDto)))); });
public async Task <GenericResult <int> > AddNew(PopulationInformationDto dto) { var result = await _populationService.AddPopulationInfo(dto); return(result.GetUserSafeResult()); }