public async Task <IActionResult> Create([Bind("StaffId,FirstName,LastName,Gender,DoB,Address,Position,HireDate")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("CategoryId,Name")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("MenuId,Item,Category,Description,Price")] Menu menu)
        {
            if (ModelState.IsValid)
            {
                _context.Add(menu);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Category"] = new SelectList(_context.Category, "CategoryId", "Name", menu.Category);
            return(View(menu));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("TablesID,Number,Status,WaitStaff")] Tables tables)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tables);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["WaitStaff"] = new SelectList(_context.Staff, "StaffId", "FullName", tables.WaitStaff);
            return(View(tables));
        }
        public async Task <IActionResult> Create([Bind("SaleId,MenuId,TicketId")] Sales sales)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sales);
                await _context.SaveChangesAsync();

                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));
        }
        public async Task <IActionResult> Create([Bind("TicketId,MenuId,Date,PaymentMethod,StaffId,TableNumber")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                ticket.Date = DateTime.Now;
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                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));
        }