Пример #1
0
        public async Task <IActionResult> PutOrderItemDetails([FromRoute] int id, [FromBody] OrderItemDetails orderItemDetails)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Пример #2
0
 public void Products(OrderItem orderitem)
 {
     using (var db = new OrderItemContext()) {
         db.Entry(orderitem).State = EntityState.Added;
         db.SaveChanges();
     }
 }