public async Task <IActionResult> Create([Bind("Name")] Terminal terminal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(terminal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(terminal));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("OrderId,Date")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("DestinationId,Name,Language,CurrencyValue")] Destination destination)
        {
            if (ModelState.IsValid)
            {
                _context.Add(destination);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(destination));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("SeatId")] Seat seat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(seat);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(seat));
        }
        public async Task <IActionResult> Create([Bind("Passport,Mail,Name,Country,Address,Phone,DateOfBirth")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("TicketNumber,LandingDate,TakeOffTime")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticket));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("PlaneId,Name,NumberOfSeats")] Plane plane)
        {
            if (ModelState.IsValid)
            {
                _context.Add(plane);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(plane));
        }
        public async Task <IActionResult> Create([Bind("Name,ExtraPrice")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
Esempio n. 9
0
        public async Task <IActionResult> Create([Bind("FlightNumber,TakeOff,Landing,Price")] Flight flight)
        {
            if (ModelState.IsValid)
            {
                _context.Add(flight);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(flight));
        }
        public async Task <IActionResult> Create([Bind("PlaneId,DepartmentName")] PlaneDepartment planeDepartment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(planeDepartment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentName"] = new SelectList(_context.Department, "Name", "Name", planeDepartment.DepartmentName);
            ViewData["PlaneId"]        = new SelectList(_context.Plane, "PlaneId", "PlaneId", planeDepartment.PlaneId);
            return(View(planeDepartment));
        }
Esempio n. 11
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);


            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                FlyHighContext context = services.GetRequiredService <FlyHighContext>();

                if (context.Flight.Count() == 0)
                {
                    for (int i = 0; i < 20; i++)
                    {
                        context.Add(new Flight());
                    }
                    context.SaveChanges();
                }
            }

            host.Run();
        }