public IActionResult Lesson(LessonViewModel modelLesson)
        {
            Validation <LessonViewModel> lessonViewModel = new Validation <LessonViewModel>();

            if (ModelState.IsValid)
            {
                if (modelLesson != null)
                {
                    lessonViewModel = lessonManager.Insert(modelLesson);

                    if (lessonViewModel.ErrorList.Count == 0)
                    {
                        _IRedisCacheService.GetAllRemove();
                        toastNotification.AddSuccessToastMessage("Ders Ekleme İşlemi Başarılı");
                        return(RedirectToAction("Lesson"));
                    }
                    else
                    {
                        lessonViewModel.ErrorList.ForEach(x => toastNotification.AddAlertToastMessage(x));
                        return(RedirectToAction("Lesson"));
                    }
                }
                else
                {
                    toastNotification.AddWarningToastMessage("Ders Ekleme İşlemi Sırasında Bir Hata Meydana Geldi!");
                    return(RedirectToAction("Lesson"));
                }
            }
            else
            {
                ModelState.Values.ToList().ForEach(x => x.Errors.ToList().ForEach(y => toastNotification.AddWarningToastMessage(y.ErrorMessage)));
                return(RedirectToAction("Lesson"));
            }
        }
示例#2
0
        public IActionResult Instructor(InstructorViewModel model)
        {
            Validation <InstructorViewModel> instructorViewModel = new Validation <InstructorViewModel>();

            if (ModelState.IsValid)
            {
                if (model != null)
                {
                    instructorViewModel = ınstructorManager.Insert(model);

                    if (instructorViewModel.ErrorList.Count == 0)
                    {
                        _IRedisCacheService.GetAllRemove();
                        toastNotification.AddSuccessToastMessage("Eğitmen Ekleme İşlemi Başarılı");
                        return(RedirectToAction("Instructor"));
                    }
                    else
                    {
                        instructorViewModel.ErrorList.ForEach(x => toastNotification.AddAlertToastMessage(x));
                        return(RedirectToAction("Instructor"));
                    }
                }
                else
                {
                    toastNotification.AddWarningToastMessage("Eğitmen Ekleme İşlemi Sırasında Bir Hata Meydana Geldi!");
                    return(RedirectToAction("Instructor"));
                }
            }
            else
            {
                ModelState.Values.ToList().ForEach(x => x.Errors.ToList().ForEach(y => toastNotification.AddWarningToastMessage(y.ErrorMessage)));
                return(RedirectToAction("Instructor"));
            }
        }
        public IActionResult Index()
        {
            _IRedisCacheService.GetAllRemove();

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

            return(View(LessonList));
        }
示例#4
0
        public IActionResult addInstructorLesson(AddLessonModel addLessonModel)
        {
            _IRedisCacheService.GetLessons().Where(x => x.isFull != true).ToList().ForEach(x => addLessonModel.selectListLesson.Add(new SelectListItem(x.name, x.id.ToString())));
            branch_TeacherList = branch_TeacherManager.List().Where(x => x.teacherid == addLessonModel.TeacherId).ToList();
            branch_TeacherList.ForEach(x => addLessonModel.selectListBranch.Add(new SelectListItem(x.branchName, x.branchid.ToString())));


            if (addLessonModel != null)
            {
                Validation <Subject> valid = subjectManager.Insert(addLessonModel);

                if (valid.ErrorList.Count == 0)
                {
                    _IRedisCacheService.GetAllRemove();
                    Teacher teacher = instructorManager.List().Find(x => x.id == addLessonModel.TeacherId);
                    addLessonModel.name    = teacher.name;
                    addLessonModel.surname = teacher.surname;

                    if (addLessonModel.isPDF)
                    {
                        TempData.MyPut("model", addLessonModel);

                        return(RedirectToAction("exportSubject", "ExportPDF"));
                    }
                    else
                    {
                        toastNotification.AddSuccessToastMessage("Ders Ve Konu Kayıtları Başarıyla Gerçekleşti!");
                        return(RedirectToAction("addInstructorLesson", "SelectLesson", new { id = addLessonModel.TeacherId }));
                    }
                }
                else
                {
                    valid.ErrorList.ForEach(x => toastNotification.AddWarningToastMessage(x));
                    return(RedirectToAction("addInstructorLesson", new { id = addLessonModel.TeacherId }));
                }
            }
            else
            {
                toastNotification.AddWarningToastMessage("Ders Ve Konu Ekleme İşlemi Sırasında Bir Hata Meydana Geldi!");
                return(RedirectToAction("addInstructorLesson", new { id = addLessonModel.TeacherId }));
            }
        }