void IFileService.AddForProduct(AddPictureDto dto) { var product = _context.Products.FirstOrDefault(x => x.Id == dto.ProductId); if (product == null) { throw new EmptyListException("Produkt nie istnieje"); } product.PictureURL = $"http://visacomhotchocolate.cba.pl/images/{dto.PictureName}.jpg"; _context.SaveChanges(); }
public ActionResult AddPictureForProduct([FromBody] AddPictureDto dto) { _fileService.AddForProduct(dto); return(Ok()); }