Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,Quantitiy")] ShoppingItem shoppingItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoppingItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoppingItem));
        }
        public async Task <IActionResult> Create([Bind("ID,Date,Price")] ShoppingBag shoppingBag)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoppingBag);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoppingBag));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,FirstName")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,Price,Omschr")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

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