コード例 #1
0
        public async Task <ActionResult <DCoworkingOrder> > PostDCoworkingOrder(DCoworkingOrder dCoworkingOrder)
        {
            _context.DCoworkingOrders.Add(dCoworkingOrder);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDCoworkingOrder", new { id = dCoworkingOrder.id }, dCoworkingOrder));
        }
コード例 #2
0
        public async Task <IActionResult> PutDCoworkingOrder(int id, DCoworkingOrder dCoworkingOrder)
        {
            if (id != dCoworkingOrder.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }