Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Topping,Price,Amount,Type")] Ingredients ingredients)
        {
            if (id != ingredients.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ingredients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IngredientsExists(ingredients.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ingredients));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,PizzaId,IngredientId,Finished")] PizzaIngredients pizzaIngredients)
        {
            if (id != pizzaIngredients.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pizzaIngredients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PizzaIngredientsExists(pizzaIngredients.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IngredientId"] = new SelectList(_context.Ingredients, "Id", "Topping", pizzaIngredients.IngredientId);
            ViewData["PizzaId"]      = new SelectList(_context.Pizza, "Id", "Id", pizzaIngredients.PizzaId);
            return(View(pizzaIngredients));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrderId,Amount")] Pizza pizza)
        {
            if (id != pizza.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pizza);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PizzaExists(pizza.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"] = new SelectList(_context.Orders, "Id", "Id", pizza.OrderId);
            return(View(pizza));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TotalPrice,OrderStatus,PlaceDate,DeliveryDate,StoreId,EmployeeId,CustomerId")] Orders orders)
        {
            if (id != orders.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "FirstName", orders.CustomerId);
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "Username", orders.EmployeeId);
            ViewData["StoreId"]    = new SelectList(_context.Store, "Id", "Id", orders.StoreId);
            return(View(orders));
        }
Exemplo n.º 5
0
 public void UpdateUser(User _user)
 {
     _context.Update(_user);
     _context.SaveChanges();
 }