public async Task <IActionResult> Edit(int id, [Bind("RouteListingsId,FkListingsId,FkRoutesId,ScheduledTime")] RouteListings routeListings) { if (id != routeListings.RouteListingsId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(routeListings); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RouteListingsExists(routeListings.RouteListingsId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FkListingsId"] = new SelectList(_context.Listings, "ListingsId", "ListingNumber", routeListings.FkListingsId); ViewData["FkRoutesId"] = new SelectList(_context.Routes, "RoutesId", "RouteName", routeListings.FkRoutesId); return(PartialView(routeListings)); }
public async Task <IActionResult> Create([Bind("RouteListingsId,FkListingsId,FkRoutesId,ScheduledTime")] RouteListings routeListings) { if (ModelState.IsValid) { _context.Add(routeListings); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkListingsId"] = new SelectList(_context.Listings, "ListingsId", "ListingNumber", routeListings.FkListingsId); ViewData["FkRoutesId"] = new SelectList(_context.Routes, "RoutesId", "RouteName", routeListings.FkRoutesId); return(PartialView(routeListings)); }