public async Task <Result <WebsiteResponse, ErrorResponse> > HandleGetRequest(int websiteId) { var entity = await _websiteRepositoty.GetById(websiteId); if (entity is null) { return(Utility.ErrorResponse()); } var image = await _fileService.DownloadImage(entity.FilePath); var result = _mapper.EntityToResponse(entity, image); return(new Result <WebsiteResponse, ErrorResponse> { IsSuccess = true, Success = result }); }
private async Task <List <WebsiteResponse> > GetResponseRecords(PaginationWebsitesDto paginationEntityResult) { var responseRecords = new List <WebsiteResponse>(); foreach (var record in paginationEntityResult.Records) { var path = record.FilePath; var image = await _fileService.DownloadImage(path); var reponseWebsite = _mapper.EntityToResponse(record, image); responseRecords.Add(reponseWebsite); } return(responseRecords); }