コード例 #1
0
        public async Task <ActionResult <ShipmentBags> > PostShipmentBags(ShipmentBags shipmentBags)
        {
            _context.ShipmentBags.Add(shipmentBags);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetShipmentBags", new { id = shipmentBags.Id }, shipmentBags));
        }
コード例 #2
0
        public async Task <IActionResult> PutShipmentBags(Guid id, ShipmentBags shipmentBags)
        {
            if (id != shipmentBags.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }