예제 #1
0
        public async Task <IActionResult> CreateProductInventory([FromBody] Production.ProductInventory value)
        {
            _db.Production_ProductInventory.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
예제 #2
0
        public async Task <IActionResult> EditProductInventory(short locationID, int productID, [FromBody] Production.ProductInventory value)
        {
            var existing = await _db.Production_ProductInventory.FirstOrDefaultAsync(x => x.LocationID == locationID && x.ProductID == productID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.ProductID    = value.ProductID;
            existing.LocationID   = value.LocationID;
            existing.Shelf        = value.Shelf;
            existing.Bin          = value.Bin;
            existing.Quantity     = value.Quantity;
            existing.rowguid      = value.rowguid;
            existing.ModifiedDate = value.ModifiedDate;

            _db.Production_ProductInventory.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }