public ActionResult RedirectToAssignCourseToDriver() { IEnumerable <CourseModel> courseList = courseAdapter.SelectAllCourses().OrderBy(x => x.Title); IEnumerable <DriverModel> driverList = driverAdapter.SelectAllDrivers().OrderBy(x => x.DriverId); IEnumerable <Priority> priorityList = priorityAdapter.SelectAllPriorities().OrderBy(x => x.Name); DriverLinkCourseModel linkModel = new DriverLinkCourseModel() { CourseList = new SelectList(courseList, "Id", "Title"), DriverList = new SelectList(driverList, "Id", "DriverId"), PriorityList = new SelectList(priorityList, "Id", "NAME") }; return(View("~/Views/Admin/Assign/AssignCourseToDriver.cshtml", linkModel)); }
// SELECT public ActionResult ViewAllCourses() { try { IEnumerable <CourseModel> results = courseAdapter.SelectAllCourses().OrderBy(x => x.Title); return(View("~/Views/Admin/ViewAll/ViewAllCourses.cshtml", results)); } catch { Log.Info($"No courses in Database"); return(View("~/Views/Error/ViewAllCoursesError.cshtml")); } }
// LOGIN public ActionResult DriverLogin(DriverModel driverLogin) { try { var verifyLogin = driverValidationManager.CheckDriverIdIsValid(driverLogin); if (verifyLogin == true) { var driverCourses = courseAdapter.SelectAllCourses(); return(View("DriverAssignedCourses", driverCourses)); } else { return(View("ErrorDriverLogin")); } } catch { return(View()); } }