Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderID,IsPlaced,IsPrepared,IsPaid,TableID")] Order order)
        {
            if (id != order.OrderID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TableID"] = new SelectList(_context.Tables, "TableID", "TableID", order.TableID);
            return(View(order));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("MenuItemID,Title,Description,Price,DiscountPrice,Category,IsAvailable,IsSpecialty,Image")] MenuItem menuItem)
        {
            if (id != menuItem.MenuItemID)
            {
                return(NotFound());
            }

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