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));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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();
        }