public async Task <IActionResult> Edit(int id, [Bind("TicketId,MenuId,Date,PaymentMethod,StaffId,TableNumber")] Ticket ticket)
        {
            if (id != ticket.TicketId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ticket);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketExists(ticket.TicketId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuId"]  = new SelectList(_context.Menu, "MenuId", "Item", ticket.MenuId);
            ViewData["StaffId"] = new SelectList(_context.Staff, "StaffId", "FullName", ticket.StaffId);
            return(View(ticket));
        }
        public async Task <IActionResult> Edit(int id, [Bind("StaffId,FirstName,LastName,Gender,DoB,Address,Position,HireDate")] Staff staff)
        {
            if (id != staff.StaffId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.StaffId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SaleId,MenuId,TicketId")] Sales sales)
        {
            if (id != sales.SaleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sales);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalesExists(sales.SaleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuId"]   = new SelectList(_context.Menu, "MenuId", "MenuId", sales.MenuId);
            ViewData["TicketId"] = new SelectList(_context.Ticket, "TicketId", "TicketId", sales.TicketId);
            return(View(sales));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("MenuId,Item,Category,Description,Price")] Menu menu)
        {
            if (id != menu.MenuId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(menu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MenuExists(menu.MenuId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Category"] = new SelectList(_context.Category, "CategoryId", "Name", menu.Category);
            return(View(menu));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("TablesID,Number,Status,WaitStaff")] Tables tables)
        {
            if (id != tables.TablesID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tables);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TablesExists(tables.TablesID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["WaitStaff"] = new SelectList(_context.Staff, "StaffId", "FullName", tables.WaitStaff);
            return(View(tables));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id, [Bind("CategoryId,Name")] Category category)
        {
            if (id != category.CategoryId)
            {
                return(NotFound());
            }

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