public async Task <GetItemPicturesOutputDto> GetCoverPicture(GetItemPicturesInputDto input) { var pic = await _itemPicRepository.FirstOrDefaultAsync(p => p.ItemId == input.Id && p.IsCover); return(new GetItemPicturesOutputDto { Id = pic.Id, Height = pic.Height, Width = pic.Width, IsCover = pic.IsCover, //Url = new Uri(new Uri(_appConfiguration["App:ImageUrlPrefix"]), Path.Combine(pic.Path, pic.FileName + pic.Extension)).ToString() Url = _appConfiguration["App:ImageUrlPrefix"] + "/" + pic.Path + "/" + pic.FileName + pic.Extension }); }
public async Task <ListResultDto <GetItemPicturesOutputDto> > GetItemPictures(GetItemPicturesInputDto input) { var list = await _itemPicRepository.GetAll().Where(p => p.ItemId == input.Id).OrderBy(p => p.Index).Select(p => new GetItemPicturesOutputDto { Id = p.Id, Height = p.Height, Width = p.Width, IsCover = p.IsCover, //Url = new Uri(new Uri(_appConfiguration["App:ImageUrlPrefix"]), Path.Combine(p.Path, p.FileName + p.Extension)).ToString() Url = _appConfiguration["App:ImageUrlPrefix"] + "/" + p.Path + "/" + p.FileName + p.Extension }).ToListAsync(); return(new ListResultDto <GetItemPicturesOutputDto>(list)); }