Пример #1
0
        public async Task <IActionResult> Create([Bind("MenuItemID,Title,Description,Price,DiscountPrice,Category,IsAvailable,IsSpecialty,Image")] MenuItem menuItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(menuItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(menuItem));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("OrderID,IsPlaced,IsPrepared,IsPaid,TableID")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TableID"] = new SelectList(_context.Tables, "TableID", "TableID", order.TableID);
            return(View(order));
        }