public ActionResult RedirectToDriverAddView()
        {
            try
            {
                var         driverGroupList = driverGroupAdapter.SelectAllDriverGroups();
                DriverModel driverModel     = new DriverModel()
                {
                    GroupsList = new SelectList(driverGroupList, "Id", "Name")
                };

                return(View("~/Views/Admin/Add/AddDriver.cshtml", driverModel));
            }
            catch (Exception)
            {
                Log.Info($"Driver cannot be added because no driver group exists in database");
                return(View("~/Views/Error/RedirectToDriverAddViewError.cshtml"));
            }
        }
        // SELECT

        public ActionResult ViewAllDriverGroups()
        {
            try
            {
                var results = driverGroupAdapter.SelectAllDriverGroups().OrderBy(x => x.Name);
                return(View("~/Views/Admin/ViewAll/ViewAllDriverGroups.cshtml", results));
            }
            catch
            {
                Log.Info("No driver groups to display");
                return(View("~/Views/Error/ViewAllDriverGroupsError.cshtml"));
            }
        }
Example #3
0
        public ActionResult RedirectToAssignCourseToDriverGroup()
        {
            IEnumerable <CourseModel>      courseList      = courseAdapter.SelectAllCourses().OrderBy(x => x.Title);
            IEnumerable <Priority>         priorityList    = priorityAdapter.SelectAllPriorities().OrderBy(x => x.Name);
            IEnumerable <DriverGroupModel> driverGroupList = driverGroupAdapter.SelectAllDriverGroups().OrderBy(x => x.Name);

            DriverLinkCourseModel assignmentModel = new DriverLinkCourseModel()
            {
                CourseList   = new SelectList(courseList, "Id", "Title"),
                PriorityList = new SelectList(priorityList, "Id", "NAME"),
                GroupsList   = new SelectList(driverGroupList, "Id", "NAME")
            };

            return(View("~/Views/Admin/Assign/AssignCourseToDriverGroup.cshtml", assignmentModel));
        }