예제 #1
0
        // GET: Lession
        public ActionResult Index(int uid)
        {
            try
            {
                Lesson currentLesson = dataContext.Lessons.Where(x => x.ID == uid).FirstOrDefault();

                ViewBag.Lesson = dataAdapter.Chain(currentLesson);

                if (currentLesson.Order > 1)
                {
                    List <Lesson> lstPreviousLessions = dataContext.Lessons.Take(currentLesson.Order - 1).ToList <Lesson>();

                    ViewBag.PreviousLessons = dataAdapter.Convert(lstPreviousLessions);
                }
                else
                {
                    List <Lesson> lstPreviousLessions = new List <Lesson>();

                    ViewBag.PreviousLessons = dataAdapter.Convert(lstPreviousLessions);
                }

                List <Lesson> lstNextLessions = dataContext.Lessons.Skip(currentLesson.Order).ToList <Lesson>();

                ViewBag.NextLessons = dataAdapter.Convert(lstNextLessions);

                return(View());
            }
            catch (Exception e)
            {
                return(HttpNotFound("I cannot found your Lesson! :("));
            }
        }
예제 #2
0
        // GET: Instructor/All
        public ActionResult All()
        {
            List <Instructor> lstInstructor = dataContext.Instructors.ToList <Instructor>();

            int numberOfCardHolders = lstInstructor.Count() / 5;

            List <DAL.Models.Instructor>[] arrInstructor;

            if (lstInstructor.Count() - lstInstructor.Count() / 5 * 5 > 0)
            {
                arrInstructor = new List <DAL.Models.Instructor> [numberOfCardHolders + 1];
            }
            else
            {
                arrInstructor = new List <DAL.Models.Instructor> [numberOfCardHolders];
            }

            for (int i = 0; i < arrInstructor.Length; i++)
            {
                List <Instructor> temp = lstInstructor.Skip(i * 5).Take(5).ToList <Instructor>();

                arrInstructor[i] = dataAdapter.Convert(temp);
            }

            ViewBag.Instructors = arrInstructor;

            return(View("All"));
        }
예제 #3
0
        public ActionResult TaughtByLeaders()
        {
            List <Instructor> lst4Instructor = dataContext.Instructors.Take(4).ToList <Instructor>();

            List <Instructor> lst6Instructor = dataContext.Instructors.Skip(4).Take(6).ToList <Instructor>();

            List <Instructor> lstRestInstructor = dataContext.Instructors.Skip(10).ToList <Instructor>();


            ViewBag.First4Instructors = dataAdapter.Convert(lst4Instructor);

            ViewBag.Second6Instructors = dataAdapter.Convert(lst6Instructor);

            ViewBag.LastInstructors = dataAdapter.Convert(lstRestInstructor);

            return(PartialView("TaughtByLeaders"));
        }
        // GET: Technology/All
        public ActionResult All()
        {
            List <Technology> lstTechnology = dataContext.Technologies.ToList <Technology>();

            ViewBag.Technologies = dataAdapter.Convert(lstTechnology);

            return(View("All"));
        }