Esempio n. 1
0
        /// <summary>
        /// Displays all tests for specified subject.
        /// </summary>
        /// <param name="subject"> SubjectViewModel instance.</param>
        /// <param name="pageNumber"> Page number.</param>
        /// <returns> Index view.</returns>
        public ActionResult Index(SubjectViewModel subject, int?pageNumber)
        {
            var tests = testService.GetTestsBySubject(subject.ToBllSubject()).Select(t => t.ToTestViewModel());

            if (Request.IsAjaxRequest())
            {
                return(PartialView(tests.ToPagedList(pageNumber ?? 1, 10)));
            }
            return(View(tests.ToPagedList(pageNumber ?? 1, 10)));
        }