示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,UserIdfk,LocationsIdfk,DateTimeOrder")] 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["LocationsIdfk"] = new SelectList(_context.Locations, "LocationsId", "LocationsId", orders.LocationsIdfk);
            ViewData["UserIdfk"]      = new SelectList(_context.Users, "Id", "Id", orders.UserIdfk);
            return(View(orders));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("PizzaId,Pizza1,Size,Cost,OrdersIdfk,Doug,Cheese,Pepperoni,Sausage,Bacon,Onion,Chiken,Sauce,Chorizo")] Pizza pizza)
        {
            if (id != pizza.PizzaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pizza);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PizzaExists(pizza.PizzaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrdersIdfk"] = new SelectList(_context.Orders, "OrderId", "OrderId", pizza.OrdersIdfk);
            return(View(pizza));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PhoneNumber,DefaultLocationFk")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DefaultLocationFk"] = new SelectList(_context.Locations, "LocationsId", "LocationsId", users.DefaultLocationFk);
            return(View(users));
        }
        public async Task <IActionResult> Edit(int id, [Bind("LocationsId,Locations1,Doug,Cheese,Pepperoni,Sausage,Bacon,Onion,Chiken,Sauce,Chorizo")] Locations locations)
        {
            if (id != locations.LocationsId)
            {
                return(NotFound());
            }

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