Ejemplo n.º 1
0
        public async Task <ActionResult <Product> > PostProduct(int id, Product product)
        {
            if (id != product.Id)
            {
                return(BadRequest());
            }
            _context.Entry(product).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }
            var productFromStore = _context.Product.Where(p => p.Id == id).SingleOrDefault();

            return(productFromStore);
        }