Beispiel #1
0
        public async Task <IActionResult> PostInventoryLiquidation([FromBody] InventoryLiquidation inventoryLiquidation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.InventoryLiquidations.Add(inventoryLiquidation);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetInventoryLiquidation", new { id = inventoryLiquidation.Id }, inventoryLiquidation));
        }
Beispiel #2
0
        public async Task <IActionResult> PutInventoryLiquidation([FromRoute] int id, [FromBody] InventoryLiquidation inventoryLiquidation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != inventoryLiquidation.Id)
            {
                return(BadRequest());
            }

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

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

            return(Ok(_context.InventoryLiquidations.Find(id)));
        }