Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CartID,ShoppingCartID,Quantity")] Cart cart)
        {
            if (id != cart.CartID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CartExists(cart.CartID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cart));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("GameID,Image,Title,Genre,UnitPrice,Description,UnitsInStock")] Game game)
        {
            if (id != game.GameID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(game);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameExists(game.GameID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(game));
        }