예제 #1
0
        public async Task <ActionResult <Product> > Post(
            [FromBody] Product product)
        {
            if (ModelState.IsValid)
            {
                product.Offer = await _offerService.FindByIdAsync(product.OfferId);

                await _productService.AddAsync(product);

                return(product);
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }