// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. //Updates the driver. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Driver).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DriverExists(Driver.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. //Creates the route. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Route.Add(Route); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Deletes the route . uses a linq query to select. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Route = (from route in _context.Route where route.Id == id select route).FirstOrDefault(); if (Route != null) { _context.Route.Remove(Route); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Deletes the driver uses a linq query to delete the driver. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Driver = (from driver in _context.Driver where driver.Id == id select driver).FirstOrDefault(); if (Driver != null) { _context.Driver.Remove(Driver); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Deletes the bus record from database.Uses a linq query to select the bus. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Bus = (from bus in _context.Bus where bus.Id == id select bus).FirstOrDefault(); if (Bus != null) { _context.Bus.Remove(Bus); _context.SaveChanges(); } return(RedirectToPage("./Index")); }