public async Task <ActionResult <CartedProduct> > PostCartedProduct(CartedProduct cartedProduct) { _context.CartedProduct.Add(cartedProduct); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCartedProduct", new { id = cartedProduct.Id }, cartedProduct)); }
public async Task <IActionResult> PutCartedProduct(Guid id, CartedProduct cartedProduct) { if (id != cartedProduct.Id) { return(BadRequest()); } _context.Entry(cartedProduct).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CartedProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }