コード例 #1
0
ファイル: CoursesController.cs プロジェクト: irshad5246/SMS
        // GET: Dashboard/Courses
        public ActionResult Index(string searchTerm, int?courseID, int?pageNo)
        {
            CourseListingModel model = new CourseListingModel();
            int recordSize           = 9;

            pageNo           = pageNo ?? 1;
            model.SearchTerm = searchTerm;

            model.Courses = CourseService.Instance.SearchCourses(searchTerm, pageNo.Value, recordSize);
            var totalRecord = CourseService.Instance.SearchCourseCount(searchTerm);

            model.Pager = new Pager(totalRecord, pageNo, recordSize);

            return(View(model));
        }
コード例 #2
0
        public CourseListingModel GetItemsByPage(int page, Item courses, int ItemsCount = 0)
        {
            var ITEM_PER_PAGE = ItemsCount;

            if (RenderingContext.CurrentOrNull != null)
            {
                ITEM_PER_PAGE = RenderingContext.Current.Rendering.GetIntegerParameter("ITEM_PER_PAGE", 3);
            }
            CourseListingModel model = new CourseListingModel();

            model.Courses     = new List <Item>(courses.Axes.GetDescendants()).Skip((page - 1) * ITEM_PER_PAGE).Take(ITEM_PER_PAGE).ToArray();
            model.CoursesSize = courses.GetChildren().Count;
            model.PageMax     = (model.CoursesSize + ITEM_PER_PAGE - 1) / ITEM_PER_PAGE;
            model.CourseId    = courses.ID.ToString();
            model.ItemsCount  = ITEM_PER_PAGE;
            return(model);
        }
コード例 #3
0
        public ActionResult ListCourse()
        {
            CourseListingModel model = CourseListingServices.getInstance().GetItemsByPage(1, Context.Item);

            return(View("~/Views/Course/CourseListing.cshtml", model));
        }