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));
        }
Esempio n. 2
0
        public IActionResult GetTeacher(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;
            }

            TeacherLessonCO model = new TeacherLessonCO();

            var teacher = _kullaniciService.GetByTeacher(guid);

            if (teacher == null)
            {
                return(View("Error"));
            }
            var lessons = _tutorLessonService.GetByLessons(guid);

            model.Kullanici   = teacher;
            model.TutorLesson = lessons;
            return(View(model));
        }
Esempio n. 3
0
        public IActionResult Profil()
        {
            int         kulId = Convert.ToInt32(User.FindFirst(ClaimTypes.NameIdentifier).Value);
            Kullanici   kul   = _kullaniciService.GetById(kulId);
            KullaniciVM kulVM = _mapper.Map <KullaniciVM>(kul);

            return(View(kulVM));
        }
Esempio n. 4
0
        public async Task <IActionResult> Giris(string kulAdi, string sifre)
        {
            await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            Kullanici kul = _kullaniciService.GetById(kulAdi, sifre);

            if (kul != null)
            {
                var claims = new List <Claim>
                {
                    new Claim(ClaimTypes.Name, kul.KullaniciAdi),
                    new Claim(ClaimTypes.NameIdentifier, kul.Id.ToString()),
                };

                var             userIdentity = new ClaimsIdentity(claims, "Login");
                ClaimsPrincipal principal    = new ClaimsPrincipal(userIdentity);

                await HttpContext.SignInAsync(principal);


                return(Json(true));
            }
            else
            {
                return(Json(false));
            }
        }
 public IActionResult Getir(int id)
 {
     try
     {
         var kullanici = _kullaniciService.GetById(id);
         return(Ok(kullanici));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
        public ActionResult GetAppointments()
        {
            var user = _kullaniciService.GetById(Convert.ToInt32(User.Claims.Where(c => c.Type == ClaimTypes.Name).Select(c => c.Value)
                                                                 .SingleOrDefault()));

            if (user.YetkiId == 2)
            {
                var silineceklerr = _scheduleService.GetByAll().Where(x =>
                                                                      !x.Silindi && x.Aktif && x.KullaniciId == user.Id && x.TutorSchedule.LessonStartDate < DateTime.Now).ToList();
                if (silineceklerr.Count > 0)
                {
                    foreach (var item in silineceklerr)
                    {
                        _scheduleService.Delete(item.Id);
                    }
                }

                var appointmentss = _scheduleService.GetByAll()
                                    .Where(x => !x.Silindi && x.Aktif && x.KullaniciId == user.Id)
                                    .OrderByDescending(x => x.TutorSchedule.LessonStartDate).ToList();

                return(View("IndexStudent", appointmentss));
            }

            var silinecekler = _scheduleService.GetByAll().Where(x =>
                                                                 !x.Silindi && x.Aktif && x.KullaniciId == user.Id && x.TutorSchedule.LessonStartDate < DateTime.Now).ToList();

            if (silinecekler.Count > 0)
            {
                foreach (var item in silinecekler)
                {
                    _scheduleService.Delete(item.Id);
                }
            }

            var appointments = _scheduleService.GetByAll()
                               .Where(x => !x.Silindi && x.Aktif && x.TutorSchedule.Kullanici.Guid == user.Guid)
                               .OrderByDescending(x => x.TutorSchedule.LessonStartDate);

            return(View("IndexTeacher", appointments));
        }
Esempio n. 7
0
 public Kullanici Login(Kullanici kullanici)
 {
     return(_kullaniciService.GetById(kullanici.KullaniciAdi, kullanici.Sifre));
 }
Esempio n. 8
0
        public IActionResult GetList(int Id)
        {
            var result = _kullaniciService.GetById(Id);

            return(Ok(result));
        }