コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PizzaName,Costs")] 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)));
            }
            return(View(pizza));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("StoreIngredientsAddressId,Id,IngredientStock")] StoreIngredients storeIngredients)
        {
            if (id != storeIngredients.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(storeIngredients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StoreIngredientsExists(storeIngredients.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StoreIngredientsAddressId"] = new SelectList(_context.Store, "StoreAddressId", "Address1", storeIngredients.StoreIngredientsAddressId);
            return(View(storeIngredients));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("UserOrderAddressId,StoreAddressId,Id,NumberOfPizza")] 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["StoreAddressId"] = new SelectList(_context.Store, "StoreAddressId", "Address1", orders.StoreAddressId);
            return(View(orders));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PizzaId,IngredientName,IngredientCost")] 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["PizzaId"] = new SelectList(_context.Pizza, "Id", "PizzaName", pizzaIngredients.PizzaId);
            return(View(pizzaIngredients));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("UserAddressId,Address1,Address2,City,ProvidenceState,PostalCode,CountryAbrev")] UserAddress userAddress)
        {
            if (id != userAddress.UserAddressId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userAddress);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserAddressExists(userAddress.UserAddressId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserAddressId"] = new SelectList(_context.UserTbl, "UserId", "FirstName", userAddress.UserAddressId);
            return(View(userAddress));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrderId,PizzaId,OrderId1")] OrderedPizzas orderedPizzas)
        {
            if (id != orderedPizzas.OrderId1)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderedPizzas);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderedPizzasExists(orderedPizzas.OrderId1))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"]      = new SelectList(_context.Pizza, "Id", "PizzaName", orderedPizzas.Id);
            ViewData["OrderId"] = new SelectList(_context.Orders, "Id", "Id", orderedPizzas.OrderId);
            ViewData["PizzaId"] = new SelectList(_context.Pizza, "Id", "PizzaName", orderedPizzas.PizzaId);
            return(View(orderedPizzas));
        }
コード例 #7
0
ファイル: StoresController.cs プロジェクト: MJN22/LNPizza
        public async Task <IActionResult> Edit(int id, [Bind("StoreAddress,StoreAddressId,Address1,Address2,City,ProvidenceState,PostalCode,CountryAbrev")] Store store)
        {
            if (id != store.StoreAddressId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(store);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StoreExists(store.StoreAddressId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(store));
        }
コード例 #8
0
ファイル: UserTblsController.cs プロジェクト: MJN22/LNPizza
        public async Task <IActionResult> Edit(int id, [Bind("UserId,FirstName,LastName")] UserTbl userTbl)
        {
            if (id != userTbl.UserId)
            {
                return(NotFound());
            }

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