public async Task <IActionResult> PutPurchaseHeaders(int id, PurchaseHeaders purchaseHeaders) { if (id != purchaseHeaders.ID) { return(BadRequest()); } _context.Entry(purchaseHeaders).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchaseHeadersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <PurchaseHeaders> > PostPurchaseHeaders(PurchaseHeaders purchaseHeaders) { _context.Purchase_Headers.Add(purchaseHeaders); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPurchaseHeaders", new { id = purchaseHeaders.ID }, purchaseHeaders)); }
public async Task <ActionResult <PurchaseHeaders> > PostPurchaseHeaders(PurchaseHeaders purchase_Headers, string article_Doc, string bill_Doc) { var purchaseHeader = _context.Purchase_Headers.Where(g => g.Article_Doc == article_Doc).Where(g => g.Bill_Doc == bill_Doc).FirstOrDefault(); if (purchaseHeader == null) { _context.Purchase_Headers.Add(purchase_Headers); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPurchase_Headers", new { id = purchase_Headers.ID }, purchaseHeader)); } else { return(Ok("Duplicate")); } }