public async Task <IActionResult> Putitem(int id, item item)
        {
            if (id != item.itemId)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!itemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            // return (IActionResult)item;
            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutshoppingCart(int id, shoppingCart shoppingCart)
        {
            if (id != shoppingCart.shoppingCartId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }