//Gets the create route allocation form. public IActionResult OnGet() { ViewData["BusId"] = new SelectList(_context.Bus, "Id", "BusNumber"); ViewData["DriverId"] = new SelectList(_context.Driver, "Id", "Name"); ViewData["RouteId"] = new SelectList(_context.Set <Route>(), "Id", "Name"); return(Page()); }
//Gets the route allocation for update. public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } RouteAllocation = _context.RouteAllocation .Include(r => r.Bus) .Include(r => r.Driver) .Include(r => r.Route).FirstOrDefault(m => m.Id == id); if (RouteAllocation == null) { return(NotFound()); } ViewData["BusId"] = new SelectList(_context.Bus, "Id", "BusNumber"); ViewData["DriverId"] = new SelectList(_context.Driver, "Id", "Name"); ViewData["RouteId"] = new SelectList(_context.Set <Route>(), "Id", "Name"); return(Page()); }