public async Task <IActionResult> PostPurchaseorderdetail([FromBody] Purchaseorderdetail purchaseorderdetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Purchaseorderdetail.Add(purchaseorderdetail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (PurchaseorderdetailExists(purchaseorderdetail.PurchaseOrderDetailId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetPurchaseorderdetail", new { id = purchaseorderdetail.PurchaseOrderDetailId }, purchaseorderdetail)); }
public async Task <IActionResult> PutPurchaseorderdetail([FromRoute] int id, [FromBody] Purchaseorderdetail purchaseorderdetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != purchaseorderdetail.PurchaseOrderDetailId) { return(BadRequest()); } _context.Entry(purchaseorderdetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchaseorderdetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }