示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ReservationId,Date,Email,Table")] Reservations reservations)
        {
            if (id != reservations.ReservationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reservations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservationsExists(reservations.ReservationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Email"] = new SelectList(_context.Customers, "Email", "Email", reservations.Email);
            return(View(reservations));
        }
示例#2
0
        public async Task <IActionResult> Edit(string id, [Bind("CustomerId,FirstName,LastName,Email,DishName")] Customers customers)
        {
            if (id != customers.Email)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomersExists(customers.Email))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DishName"] = new SelectList(_context.Dishes, "DishName", "DishName", customers.DishName);
            return(View(customers));
        }
示例#3
0
        public async Task <IActionResult> Edit(string id, [Bind("DishId,DishName,DishDetails")] Dishes dishes)
        {
            if (id != dishes.DishName)
            {
                return(NotFound());
            }

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