public async Task <ActionResult <Purchaseorder2177> > PostPurchaseorder2177(Purchaseorder2177 p) { // _context.Purchaseorder2177.Add(purchaseorder2177); try { _context.Database.ExecuteSqlRaw("EXEC PURCHASE_STOCK " + "@PPRODID = " + p.Productid + ", @PLOCID = " + p.Locationid + ", @PQTY = " + p.Quantity); await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (Purchaseorder2177Exists(p.Productid)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetPurchaseorder2177", new { id = p.Productid }, p)); }
public async Task <IActionResult> PutPurchaseorder2177(int id, Purchaseorder2177 purchaseorder2177) { if (id != purchaseorder2177.Productid) { return(BadRequest()); } _context.Entry(purchaseorder2177).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Purchaseorder2177Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }