Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CartID,ShoppingCartID,Quantity")] Cart cart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cart));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("GameID,Image,Title,Genre,UnitPrice,Description,UnitsInStock")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(game));
        }