Esempio n. 1
0
        public IActionResult GetLesson(Guid guid)
        {
            var userId = Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value)
                                         .SingleOrDefault());

            if (userId > 0)
            {
                var user = _kullaniciService.GetById(userId);

                ViewBag.YetkiId = user.YetkiId;
                ViewBag.UserId  = user.Id;
            }

            TutorLessonCommentCO model = new TutorLessonCommentCO();
            var lesson = _tutorLessonService.GetByGuid(guid);

            if (lesson == null)
            {
                return(View("Error"));
            }
            var l = _lessonService.GetById(lesson.LessonId);

            if (l == null)
            {
                return(View("Error"));
            }
            var lessonComment = _lessonCommentService.GetByLessonComment(l.Guid);

            model.TutorLesson = lesson;
            model.Comment     = lessonComment;

            TempData["lessonId"] = l.Id;

            return(View(model));
        }
        public IActionResult Create(Guid guid) //tutorlesson guid
        {
            var tutorLesson          = _tutorLessonService.GetByGuid(guid);
            var deletedTutorSchedule = _tutorScheduleService.GetTutorSchedules();

            foreach (var item in deletedTutorSchedule)
            {
                if (item.LessonStartDate < DateTime.Now)
                {
                    _tutorScheduleService.Delete(item.Id);
                }
            }

            var tutorSchedule = _tutorScheduleService.GetTutorSchedules().Where(x => x.LessonId == tutorLesson.LessonId && x.KullaniciId == tutorLesson.KullaniciId).ToList();

            ViewBag.TutorSchedules = tutorSchedule;
            return(View());
        }
        public ActionResult LessonHours(Guid guid)
        {
            var tutorLesson        = _tutorLessonService.GetByGuid(guid);
            TutorScheduleDTO model = new TutorScheduleDTO();

            model.Guid      = Guid.NewGuid();
            model.EkleyenId = Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value)
                                              .SingleOrDefault());
            model.Guid          = Guid.NewGuid();
            model.EklenmeZamani = DateTime.Now;
            model.Aktif         = true;
            model.Silindi       = false;
            model.KullaniciId   = Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value)
                                                  .SingleOrDefault());
            model.LessonId = _lessonService.GetById(tutorLesson.LessonId).Id;

            var id            = _tutorScheduleService.Create(model);
            var tutorSchedule = _tutorScheduleService.GetById(id);

            return(RedirectToAction("AddLessonHours", new RouteValueDictionary(new { controller = "TutorSchedule", action = "AddLessonHours", guid = tutorSchedule.Guid })));
        }
        public ActionResult Edit(Guid guid)
        {
            var model = _tutorLessonService.GetByGuid(guid);

            return(View(model));
        }