Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ItemId,Name,IsTopping,Quantity,LocationId")] Inventory inventory)
        {
            if (id != inventory.ItemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoryExists(inventory.ItemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"] = new SelectList(_context.Locations, "LocationId", "Name", inventory.LocationId);
            return(View(inventory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrderId,PizzaId,Quantity")] OrderPizza orderPizza)
        {
            if (id != orderPizza.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderPizza);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderPizzaExists(orderPizza.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"] = new SelectList(_context.Orders, "OrderId", "OrderId", orderPizza.OrderId);
            ViewData["PizzaId"] = new SelectList(_context.Pizzas, "PizzaId", "Name", orderPizza.PizzaId);
            return(View(orderPizza));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("LocationId,Name")] Locations locations)
        {
            if (id != locations.LocationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(locations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationsExists(locations.LocationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(locations));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,UsersId,LocationId,OrderTime,Price,OrderTotal")] Orders orders)
        {
            if (id != orders.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"] = new SelectList(_context.Locations, "LocationId", "Name", orders.LocationId);
            ViewData["UsersId"]    = new SelectList(_context.Users, "UsersId", "FirstName", orders.UsersId);
            return(View(orders));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PizzaId,Name,Type,Size,Crust,Price")] Pizzas pizzas)
        {
            if (id != pizzas.PizzaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pizzas);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PizzasExists(pizzas.PizzaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pizzas));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("UsersId,FirstName,LastName,LocationId,Phone")] Users users)
        {
            if (id != users.UsersId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UsersId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }


            return(View(users));
        }
 public void EditOrder(Orders order)
 {
     _db.Update(order);
 }
 public void EditPizzaTopping(PizzaTopping hasTopping)
 {
     _db.Update(hasTopping);
 }