Beispiel #1
0
        public JsonResult SetInstructorProperty(int lessonId)
        {
            List <SelectListItem> selectListLesson = new List <SelectListItem>();

            List <Lessons> lessonList = lessonManager.List(x => !x.isFull).ToList();//Cache'den çekersen JsonIgnore Çalışmıyor

            Lessons lesson = lessonManager.Find(x => x.id == lessonId);


            int empty = 0;


            if (lessonId == 0) //Ders Seçilmediyse
            {
                selectListLesson.Add(new SelectListItem("Ders Seçilmedi", empty.ToString()));

                for (int i = 0; i < lessonList.Count; i++)
                {
                    selectListLesson.Add(new SelectListItem(lessonList[i].name, lessonList[i].id.ToString()));
                }
            }
            else
            {
                selectListLesson.Add(new SelectListItem(lesson.name, lesson.id.ToString()));

                for (int i = 0; i < lessonList.Count; i++)
                {
                    selectListLesson.Add(new SelectListItem(lessonList[i].name, lessonList[i].id.ToString()));
                }

                selectListLesson.Add(new SelectListItem("Ders Seçilmedi", empty.ToString()));
            }

            return(Json(new { lessonList = selectListLesson }));
        }
Beispiel #2
0
        public IActionResult RegisteredLesson(int id)
        {
            Teacher teacher = instructorManager.Find(x => x.id == id);

            lessonManager.List();

            return(View(teacher));
        }
        public IActionResult Index()
        {
            _IRedisCacheService.GetAllRemove();

            List <Lessons> LessonList = lessonManager.List(x => x.isFull);

            return(View(LessonList));
        }
Beispiel #4
0
        public JsonResult DeleteBranch(int?value)
        {
            if (value != null)
            {
                Branch branch = branchManager.Find(x => x.id == value);

                if (branch != null)
                {
                    List <Lessons> lessonList = lessonManager.List();

                    for (int i = 0; i < lessonList.Count; i++)
                    {
                        if (lessonList[i].branchid == branch.id)
                        {
                            lessonList[i].ownerBranch         = null;
                            lessonList[i].branchid            = null;
                            lessonList[i].isFull              = false;
                            lessonList[i].teacherid           = null;
                            lessonList[i].ownerTeacherName    = null;
                            lessonList[i].ownerTeacherSurname = null;

                            lessonManager.Update(lessonList[i]);
                        }
                    }



                    int count = branchManager.Remove(branch);

                    if (count > 0)
                    {
                        _IRedisCacheService.GetAllRemove();
                        toastNotification.AddSuccessToastMessage("Silme İşlemi Başarılı!");
                        return(Json(new { state = true }));
                    }
                    toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!");
                    return(Json(new { state = false }));
                }
                toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!");
                return(Json(new { state = false }));
            }
            toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!");
            return(Json(new { state = false }));
        }
        public List <Lessons> SetLessons()
        {
            List <Lessons> model = (from lesson in lessonManager.List()
                                    join teacher in instructorManager.List()
                                    on lesson.TeacherId equals teacher.id
                                    select new Lessons
            {
                id = lesson.id,
                name = lesson.name,
                ownerTeacherName = lesson.name,
                ownerTeacherSurname = lesson.ownerTeacherSurname,
                ownerBranch = lesson.ownerBranch
            }).ToList();

            var jsonModel = JsonConvert.SerializeObject(model);

            var options = new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(20));

            redisCache.Set("lesson-list", Encoding.UTF8.GetBytes(jsonModel), options);

            return(model);
        }