Exemple #1
0
        //[HttpPost]
        //public ActionResult AssignCourseToMultipleDrivers(List<DriverLinkCourseModel> driverList)
        //{
        //    try
        //    {
        //        foreach (var driver in driverList)
        //        {
        //            driver.State = "Assigned";
        //        }

        //        var results = linkDriverCourseAdapter.AssignCourseToMultipleDrivers(driverList);

        //        return RedirectToAction("SelectAllAssignedCourses");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}


        // EDIT

        public ActionResult EditAssignedCourseToDriver(DriverLinkCourseModel editEntry)
        {
            try
            {
                int results = linkDriverCourseAdapter.EditAssignedCourseToDriver(editEntry);

                if (results != 1)
                {
                    Log.Info($"Unable to Edit {editEntry.Course.Title} to {editEntry.Driver.DriverId} in LinkDriverCourseController -- results == {results}");
                    return(View("~/Views/Error/EnterAllInfoError.cshtml"));
                }

                return(RedirectToAction("SelectAllAssignedCourses"));
            }
            catch
            {
                Log.Info($"Unable to Edit course for driver in LinkDriverCourseController");
                return(View("~/Views/Error/EnterAllInfoError.cshtml"));
            }
        }