Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public ActionResult AddPictureForProduct([FromBody] AddPictureDto dto)
        {
            _fileService.AddForProduct(dto);

            return(Ok());
        }