示例#1
0
        public async Task <IActionResult> PutPrdOrders([FromRoute] int id, [FromBody] PrdOrders prdOrders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != prdOrders.OrderId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PostPrdOrders([FromBody] PrdOrders prdOrders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.PrdOrders.Add(prdOrders);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPrdOrders", new { id = prdOrders.OrderId }, prdOrders));
        }