//
 // GET: /Course/Delete/5
 public ActionResult Delete(int id)
 {
     using (CoursesManager)
     {
         var disp = Mapper.Map <vmCourse>(CoursesManager.GetAllCourseDetails().Where(d => d.ID == id).FirstOrDefault());
         return(View(disp));
     }
 }
 //
 // GET: /Course/Details/5
 public ActionResult Details(int id)
 {
     using (CoursesManager)
     {
         var disp = Mapper.Map <vmCourse>(CoursesManager.GetAllCourseDetails().Where(d => d.ID == id).FirstOrDefault());
         if (disp == null)
         {
             disp = new vmCourse();
             ModelState.AddModelError("", "Failed to load details for requested object");
         }
         return(View(disp));
     }
 }
        public ActionResult Index(vmCourseSearch vm)
        {
            List <CourseDetail>        toreturn = new List <CourseDetail>();
            IEnumerable <CourseDetail> courses  = null;

            using (CoursesManager)
            {
                courses = CoursesManager.GetAllCourseDetails();
                if (vm.SelectedDept > 0)
                {
                    courses = courses.Where(c => c.DepartmentID == vm.SelectedDept);
                }
                if (vm.SelectedInst > 0)
                {
                    courses = courses.Where(c => c.InstructorID == vm.SelectedInst);
                }
                if (!string.IsNullOrEmpty(vm.SearchText))
                {
                    courses = courses.Where(c => c.Title.Contains(vm.SearchText));
                }
                JsonResult result = Json(courses.ToList());
                return(result);
            }
        }