private void ConfigureBreadcrumbs(BLL.Models.Department department)
        {
            var university = department.University;

            ViewBag.Breadcrumbs = new List <Breadcrumb>
            {
                new Breadcrumb
                {
                    Controller = "UniversitiesManagement",
                    Action     = "Universities",
                    Title      = "Uczelnie"
                },
                new Breadcrumb
                {
                    Controller = "DepartmentsManagement",
                    Action     = "Departments",
                    Title      = university.Abbreviation,
                    Params     = new Dictionary <string, string>
                    {
                        { "universityId", university.UniversityId.ToString() }
                    }
                },
                new Breadcrumb
                {
                    Controller = "SemestersManagement",
                    Action     = "Semesters",
                    Title      = department.Abbreviation,
                    Params     = new Dictionary <string, string>
                    {
                        { "departmentId", department.DepartmentId.ToString() }
                    }
                }
            };
        }
Beispiel #2
0
        public IActionResult Add(DepartmentViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }

            var university = _traversalService.GetUniversity(vm.UniversityId);

            if (university == null)
            {
                return(RedirectToAction("ResourceNotFound", "Error", new { error = "uczelnia o podanym Id nie istnieje." }));
            }

            var departmentToAdd = new BLL.Models.Department(vm.TitleOrFullName, vm.SubtitleOrAbbreviation, university);

            var success = _managementService.AddDepartment(departmentToAdd);

            if (!success)
            {
                ModelState.AddModelError("ERROR", "Wydział o takiej nazwie lub skrócie istnieje już na tej uczelni");
                return(View(vm));
            }

            return(RedirectToAction("Departments", new { universityId = vm.UniversityId }));
        }
Beispiel #3
0
        private void ConfigureDeleteBreadcrumbs(BLL.Models.Department department)
        {
            ConfigureListBreadcrumbs(department.University);

            ViewBag.Breadcrumbs.Add(
                new Breadcrumb
            {
                Controller = "DepartmentsManagement",
                Action     = "Delete",
                Title      = "Usuwanie wydziału",
                Params     = new Dictionary <string, string>
                {
                    { "departmentId", department.DepartmentId.ToString() }
                }
            }
                );
        }
Beispiel #4
0
        private void ConfigureSemestersBreadcrumbs(BLL.Models.Department department, bool includeTitleDescription)
        {
            ConfigureDepartmentsBreadcrumbs(department.University, includeTitleDescription: false);

            ViewBag.Breadcrumbs.Add(
                new Breadcrumb
            {
                Controller = "List",
                Action     = "Semesters",
                Title      = department.Abbreviation + (includeTitleDescription ? " - Semestry" : ""),
                Params     = new Dictionary <string, string>
                {
                    { "departmentId", department.DepartmentId.ToString() }
                }
            }
                );
        }
Beispiel #5
0
        private void ConfigureAddBreadcrumbs(BLL.Models.Semester semester, BLL.Models.Department department, BLL.Models.University university)
        {
            ConfigureListBreadcrumbs(semester, department, university);

            ViewBag.Breadcrumbs.Add(
                new Breadcrumb
            {
                Controller = "LessonsManagement",
                Action     = "Add",
                Title      = "Dodawanie przedmiotu",
                Params     = new Dictionary <string, string>
                {
                    { "semesterId", semester.SemesterId.ToString() },
                    { "departmentId", department.DepartmentId.ToString() }
                }
            }
                );
        }
Beispiel #6
0
        private void ConfigureLessonsBreadcrumbs(BLL.Models.Semester semester, BLL.Models.Department department, BLL.Models.University university)
        {
            ConfigureSemestersBreadcrumbs(department, includeTitleDescription: false);

            ViewBag.Breadcrumbs.Add(
                new Breadcrumb
            {
                Controller = "List",
                Action     = "Lessons",
                Title      = semester.Number + " - Przedmioty",
                Params     = new Dictionary <string, string>
                {
                    { "semesterId", semester.SemesterId.ToString() },
                    { "departmentId", department.DepartmentId.ToString() }
                }
            }
                );
        }
Beispiel #7
0
 private void ConfigureListBreadcrumbs(BLL.Models.Semester semester, BLL.Models.Department department, BLL.Models.University university)
 {
     ViewBag.Breadcrumbs = new List <Breadcrumb>
     {
         new Breadcrumb
         {
             Controller = "List",
             Action     = "AvailableUniversities",
             Title      = "Uczelnie"
         },
         new Breadcrumb
         {
             Controller = "List",
             Action     = "Departments",
             Title      = university.Abbreviation,
             Params     = new Dictionary <string, string>
             {
                 { "universityId", university.UniversityId.ToString() }
             }
         },
         new Breadcrumb
         {
             Controller = "List",
             Action     = "Semesters",
             Title      = department.Abbreviation,
             Params     = new Dictionary <string, string>
             {
                 { "departmentId", department.DepartmentId.ToString() },
             }
         },
         new Breadcrumb
         {
             Controller = "List",
             Action     = "Lessons",
             Title      = semester.Number,
             Params     = new Dictionary <string, string>
             {
                 { "semesterId", semester.SemesterId.ToString() },
                 { "departmentId", department.DepartmentId.ToString() }
             }
         }
     };
 }