コード例 #1
0
        public ActionResult SavePopularCourses(PopularCourse pc)
        {
            _popularCourseRepo.Save(pc);

            return RedirectToAction("PopularCourses");
        }
コード例 #2
0
        public ActionResult PopularCourses()
        {
            if (NotAllowedHere()) return RedirectAway();

            var vm = new PopularCoursesViewModel();

            var pc = new PopularCourse();
            pc = _popularCourseRepo.FindAll().FirstOrDefault();

            vm.Posts = _postRepo.FindAll().Where(p => p.postType == 0).ToList();
            vm.ID = pc.ID;
            vm.CourseOne = pc.CourseOne;
            vm.CourseTwo = pc.CourseTwo;
            vm.CourseThree = pc.CourseThree;
            vm.CourseFour = pc.CourseFour;

            return View(vm);
        }