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