Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("DishId,DishName,DishDetails")] Dishes dishes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dishes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dishes));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,Email,DishName")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DishName"] = new SelectList(_context.Dishes, "DishName", "DishName", customers.DishName);
            return(View(customers));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ReservationId,Date,Email,Table")] Reservations reservations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reservations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Email"] = new SelectList(_context.Customers, "Email", "Email", reservations.Email);
            return(View(reservations));
        }