Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Comments")] Meal meal)
        {
            if (id != meal.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MealExists(meal.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meal));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("TableCategoryId,TableCapacity")] TableCategory tableCategory)
        {
            if (id != tableCategory.TableCategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tableCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableCategoryExists(tableCategory.TableCategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tableCategory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TableId,TableCategoryId,IsBooked")] Table table)
        {
            if (id != table.TableId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(table);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableExists(table.TableId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TableCategoryId"] = new SelectList(_context.TableCategories, "TableCategoryId", "TableCategoryId", table.TableCategoryId);
            return(View(table));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Chef chef)
        {
            if (id != chef.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chef);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChefExists(chef.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chef));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("BookingId,BookingDate,CustomerId,TableId")] Booking booking)
        {
            if (id != booking.BookingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.BookingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", booking.CustomerId);
            ViewData["TableId"]    = new SelectList(_context.Tables, "TableId", "TableId", booking.TableId);
            return(View(booking));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,Address,PhoneNumber,EmailAddress,GroupCount")] Customer customer)
        {
            if (id != customer.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Ejemplo n.º 7
0
        public void Update(MenuItem item)
        {
            MenuItem itemToUpdate = context.MenuItems.FirstOrDefault(d => d.Id == item.Id);

            itemToUpdate.Name        = item.Name;
            itemToUpdate.Description = item.Description;
            itemToUpdate.Price       = item.Price;

            context.Update(itemToUpdate);
            context.SaveChanges();
        }
Ejemplo n.º 8
0
 public IActionResult UpdateMenu([FromBody] Menu menu)
 {
     _context.Update(menu);
     _context.SaveChanges();
     return(new OkResult());
 }
Ejemplo n.º 9
0
 public void Update(Restaurant restaurant)
 {
     _dbContext.Update(restaurant);
     _dbContext.SaveChanges();
 }
Ejemplo n.º 10
0
 public IActionResult Update(Reservation r)
 {
     _context.Update(r);
     _context.SaveChanges();
     return(RedirectToAction("Details"));
 }
Ejemplo n.º 11
0
 public IActionResult UpdateVoucher([FromBody] Vouchers voucher)
 {
     _context.Update(voucher);
     _context.SaveChanges();
     return(new OkResult());
 }