public async Task <ActionResult <Productsdetail> > PostProductsdetail(Productsdetail productsdetail) { _context.Productsdetail.Add(productsdetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail)); }
public async Task <IActionResult> PutProductsdetail(Guid id, Productsdetail productsdetail) { if (id != productsdetail.Id) { return(BadRequest()); } _context.Entry(productsdetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsdetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostProductsdetail([FromBody] Productsdetail productsdetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Productsdetail.Add(productsdetail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProductsdetailExists(productsdetail.Id)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail)); }
public async Task <ActionResult <Productsdetail> > PostProductsdetail(Productsdetail productsdetail) { _context.Productsdetail.Add(productsdetail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProductsdetailExists(productsdetail.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetProductsdetail", new { id = productsdetail.Id }, productsdetail)); }