// 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)); }
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); }
public ActionResult ListCourse() { CourseListingModel model = CourseListingServices.getInstance().GetItemsByPage(1, Context.Item); return(View("~/Views/Course/CourseListing.cshtml", model)); }