public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,MobileNo,EmailAddress")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customers));
        }
        public async Task <IActionResult> Create([Bind("RouteId,RouteName")] Routes routes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(routes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(routes));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("BookingId,CustomerId,NoAdults,NoChildren,NoInfants,SailingDate,RouteId")] Bookings bookings)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bookings);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "EmailAddress", bookings.CustomerId);
            ViewData["RouteId"]    = new SelectList(_context.Routes, "RouteId", "RouteName", bookings.RouteId);
            return(View(bookings));
        }