Beispiel #1
0
        public async Task <ActionResult <PurchaseOrder9144> > PostPurchaseorder9144(PurchaseOrder9144 p)
        {
            // _context.Purchaseorder9144.Add(purchaseorder9144);
            try
            {
                _context.Database.ExecuteSqlRaw("EXEC PURCHASE_STOCK " +
                                                "@PPRODID = " + p.ProductID +
                                                ", @PLOCID = " + p.LocationID +
                                                ", @PQTY = " + p.Amount);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (Purchaseorder9144Exists(p.ProductID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetPurchaseorder9144", new { id = p.ProductID }, p));
        }
Beispiel #2
0
        public async Task <IActionResult> PutPurchaseorder9144(int id, PurchaseOrder9144 purchaseorder9144)
        {
            if (id != purchaseorder9144.ProductID)
            {
                return(BadRequest());
            }

            _context.Entry(purchaseorder9144).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Purchaseorder9144Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }