protected virtual TDest MapToEntity(TSource model) { if (model == null) { return(null); } return(_appMapper.Map <TSource, TDest>(model)); }
public async Task <IEnumerable <ReportCode> > GetReportCodesByLocation(string officeLocation, CancellationToken token) { //if (_connectionHelper.IsNetworkAvailable()) //{ try { var response = await SendRequest(HttpRequestEnum.ReportCodesByLocation, HttpMethod.Get, null, token, officeLocation); var dtos = JsonConvert.DeserializeObject <IEnumerable <ReportCodeDto> >(response); var mapped = _appMapper.Map <IEnumerable <ReportCode> >(dtos); return(mapped); } catch (Exception) { return(new List <ReportCode>()); } //} //throw new Exception("No Internet connectivity detected. Please reconnect and try again."); }
public async Task <ReportCodeDto> CreateNew(OfficeLocationDto officeLocationDto) { var code = await _qualityReportManager.CreateNew(_appMapper.Map <OfficeLocation>(officeLocationDto)); var mapped = _appMapper.Map <ReportCodeDto>(code); return(mapped); }
public async Task <IEnumerable <OfficeLocationDto> > GetAll() { var locations = await _officeLocationDataService.GetAll(); if (locations.Count() == 0) { locations = LocationFakeGeneration.GenerateFakeList(); await _officeLocationDataService.AddRange(locations); } var mapped = _appMapper.Map <IEnumerable <OfficeLocationDto> >(locations); return(mapped); }