Esempio n. 1
0
        public IActionResult Index()
        {
            string        uyeid    = User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Sid).Value;
            Educator      educator = rEducator.GetBy(x => x.MemberID == Convert.ToInt32(uyeid));
            List <Course> courses  = rCourse.GetAllLazy(x => x.EducatorID == educator.ID, includeProperties: "Lessons").ToList();//kursa lessoncount eklenince lazy loading ile commentler cekilecek.

            /*List<Comment> comments = new List<Comment>();
             * //rComment.GetAll(x => x.CourseID == 1);
             * foreach (var item in courses)
             * {
             *  foreach (var item2 in comments)
             *  {
             *      item2.UserComment = rComment.GetBy(x=>x.CourseID== item.Id).UserComment;
             *      item2.MemberName = rComment.GetBy(x=>x.CourseID== item.Id).MemberName;
             *      item2.CommentDate = rComment.GetBy(x=>x.CourseID== item.Id).CommentDate;
             *      item2.Rate = rComment.GetBy(x=>x.CourseID== item.Id).Rate;
             *      rComment.Save();
             *  }
             * }*/
            LessonCoursesVM lessonCoursesVM = new LessonCoursesVM
            {
                Educator = educator,
                Coursess = courses
            };

            return(View(lessonCoursesVM));
        }
Esempio n. 2
0
        public IActionResult CourseSinglePage(int id)
        {
            var          course       = rCourse.GetBy(c => c.Id == id);
            Cart         cart         = null;
            CourseMember courseMember = new CourseMember();

            if (User.Identity.IsAuthenticated)     // Sepete ekle
            {
                int uyeid = Convert.ToInt32(User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Sid).Value);
                cart = rCart.GetBy(
                    x => x.MemberId == uyeid &&
                    x.CourseId == id);

                courseMember = rCourseMember.GetBy(
                    x => x.MemberId == uyeid &&
                    x.CourseId == id);
            }
            Course        courses   = rCourse.GetBy(x => x.Id == id);
            int?          educatid  = courses.EducatorID;
            Educator      educators = rEducator.GetBy(x => x.ID == educatid);
            List <Lesson> lesson    = rLesson.GetAllLazy(x => x.CourseID == id, includeProperties: "Videos").ToList();
            //Image getir
            Image           img           = myContext.Images.FirstOrDefault(i => i.CourseID == courses.Id);
            LessonCoursesVM lessonCourses = new LessonCoursesVM {
                Lessons = lesson, Courses = courses, Educator = educators, Cart = cart, courseMember = courseMember
            };

            return(View(lessonCourses));
        }
Esempio n. 3
0
        public IActionResult CourseSinglePage(int id)
        {
            //Courses.Where(x=>x.KategoriId == kategoriId).OrderByDescending(x => x.Id).Take(adet).ToList();
            var  course = rCourse.GetBy(c => c.Id == id);
            int  uyeid  = Convert.ToInt32(User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Sid).Value);
            Cart cart   = rCart.GetBy(
                x => x.MemberId == uyeid &&
                x.CourseId == id);
            Course          courses       = rCourse.GetBy(x => x.Id == id);
            int?            educatid      = courses.EducatorID;
            Educator        educators     = rEducator.GetBy(x => x.ID == educatid);
            List <Lesson>   lesson        = rLesson.GetAll(x => x.CourseID == id).ToList();
            LessonCoursesVM lessonCourses = new LessonCoursesVM {
                Lessons = lesson, Courses = courses, Educator = educators, Cart = cart
            };

            return(View(lessonCourses));
        }
Esempio n. 4
0
        public IActionResult Lessons(int id)
        {
            Lesson lesson = rLesson.GetBy(x => x.Id == id);
            //Courses.Where(x=>x.KategoriId == kategoriId).OrderByDescending(x => x.Id).Take(adet).ToList
            Course       course       = rCourse.GetBy(x => x.Id == lesson.CourseID);
            CourseMember courseMember = new CourseMember();

            if (User.Identity.IsAuthenticated)
            {
                int uyeid = Convert.ToInt32(User.Claims.FirstOrDefault(f => f.Type == ClaimTypes.Sid).Value);
                courseMember = rCourseMember.GetBy(x => x.CourseId == course.Id &&
                                                   x.MemberId == uyeid);
            }
            List <Lesson>   lessons       = rLesson.GetAll(x => x.CourseID == course.Id).ToList();
            Educator        educator      = rEducator.GetBy(x => x.ID == course.EducatorID);
            Videos          video         = rVideos.GetBy(x => x.LessonID == id);
            List <Videos>   videos        = rVideos.GetAll(x => x.CourseID == course.Id).ToList();
            LessonCoursesVM lessonCourses = new LessonCoursesVM {
                Lessons = lessons, Courses = course, Educator = educator, Video = video, Lesson = lesson, Videos = videos, courseMember = courseMember
            };

            //return View(rCourse.GetAll(x=>x.CategoryID == id).ToList(), rCategory.GetAll().ToList());
            return(View(lessonCourses));
        }