public async Task <IActionResult> PutProductModel(int id, ProductModel productModel)
        {
            if (id != productModel.ProductModelID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutOrders(int id, Order orders)
        {
            if (id != orders.OrderID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #3
0
 //update user service
 public void PutUser(int id, User user)
 {
     _context.Entry(user).State = EntityState.Modified;
 }