public ActionResult ApproveTrip(ApproveTripModel model) { using (context) { TripsTable trip = context.TripsTables.Where(x => x.TripID == model.TripID).FirstOrDefault(); trip.DriverID = model.DriverID; trip.TripStatus = (int)ETripStatus.APPROVED; context.Entry(trip).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Approved")); } }
public ActionResult LoadDrivers(int tripId, int vehicleType) { List <SelectListItem> drivers = context.DriverDetailsTables.Where(x => x.VehicleType == vehicleType).Select(c => new SelectListItem { Text = c.DriverCode, Value = c.DriverID.ToString() }).ToList(); ViewBag.DriverList = drivers; var model = new ApproveTripModel { TripID = tripId }; return(PartialView("ApprovePV", model)); }