Example #1
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 }));
            }
        }
Example #2
0
    public void Menu3()
    {
        DisplayMenu(_menu3);
        SubjectManager sb     = new SubjectManager();
        string         choice = InpuChoice();

        switch (choice)
        {
        case "0":
            MainMenu();
            break;

        case "1":
            Console.Clear();
            List <Student> std = wwf.GetFromFile <Student>("Student.json");
            Console.WriteLine("================ Nhập điểm thi =================");
            if (std == null)
            {
                Console.WriteLine("Danh sách trống! Mời nhập thông tin vào.");
            }
            else
            {
                do
                {
                    sb.Insert(std);
                } while (m.ContinueYN());
            }
            m.Press();
            Menu3();
            break;

        case "2":
            Console.Clear();
            List <Student> std1 = wwf.GetFromFile <Student>("Student.json");
            if (std1 == null)
            {
                Console.WriteLine("Danh sách trống! Mời nhập thông tin vào.");
            }
            else
            {
                sb.Display(std1, 1);
            }
            m.Press();
            Menu3();
            break;

        case "3":
            Console.Clear();
            List <Student> std2 = wwf.GetFromFile <Student>("Student.json");
            if (std2 == null)
            {
                Console.WriteLine("Danh sách trống! Mời nhập thông tin vào.");
            }
            else
            {
                sb.Display(std2, 2);
            }
            m.Press();
            Menu3();
            break;

        default:
            m.FalsePress(true);
            Menu3();
            break;
        }
    }