Exemple #1
0
        public IActionResult GetFaculty()
        {
            FacultyModel newModel = new FacultyModel();

            newModel.newList = faculty.GetAll().ToList();
            return(View("~/Views/EducationalDepartment/Faculty/Faculty.cshtml", newModel));
        }
Exemple #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = _userService.GetById(id.Value);

            if (user == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FacultyId = new SelectList(_facultyService.GetAll(), "FacultyId", "FacultyName", user.FacultyId);
            return(View(user));
        }
Exemple #3
0
        public ActionResult ListFaculties(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(PartialView(_facultyService.GetAll().OrderBy(x => x.FacultyName).ToPagedList(pageNumber, pageSize)));
        }
        public ActionResult Create(int id)
        {
            var currentEnrollee = _enrolleeService.Find(customer => customer.AppCustomer.UserName == User.Identity.Name).First();

            var faculty = _facultyService.Get(id);

            var addedFaculty = _facultyService.GetAll().Where(f => f.FacultyNumber == faculty.FacultyNumber && faculty.Enrollees.Any()).ToList();

            if (currentEnrollee.Faculties.Any(f => f.FacultyNumber == faculty.FacultyNumber))
            {
                ModelState.AddModelError("AddFaculty", "This faculty already added.");
                return(View());
            }
            else if (addedFaculty.Any() && addedFaculty.First().Enrollees.Any() &&
                     addedFaculty.First().Enrollees.Count(e => e.StudentStatuses.Any(s => s.FacultyStatus == true && s.Faculty.FacultyNumber == faculty.FacultyNumber))
                     == faculty.AllPlaces)
            {
                ModelState.AddModelError("AddFaculty", "No places are there :(");

                return(View());
            }
            else
            {
                currentEnrollee.ExaminationSubjects.Clear();
                currentEnrollee.SchoolSubjects.Clear();
                foreach (var item in _schoolSubjectsService.GetAll().ToList())
                {
                    if (!currentEnrollee.SchoolSubjects.Contains(item))
                    {
                        currentEnrollee.SchoolSubjects.Add(item);
                    }
                }

                var exSubjects = _examinationSubjectService.Find(e => e.Faculties.Any(f => f.FacultyNumber == faculty.FacultyNumber)).ToList();

                foreach (var item in exSubjects)
                {
                    if (!currentEnrollee.ExaminationSubjects.Any(s => s.Name == item.Name))
                    {
                        currentEnrollee.ExaminationSubjects.Add(item);
                    }
                }

                currentEnrollee.Faculties.Add(faculty);

                var status = new StudentStatus()
                {
                    Faculty = faculty, FacultyStatus = false, Enrollee = currentEnrollee, Status = "Enrollee"
                };

                _studentStatusService.Create(status);

                _enrolleeService.Update(currentEnrollee);

                return(View("Create", currentEnrollee));
            }
        }
Exemple #5
0
        public ActionResult DropDownFaculties()
        {
            DisplayHome home = new DisplayHome
            {
                FacultiesDTO = _faculty.GetAll()
            };

            return(PartialView(home));
        }
Exemple #6
0
        public async Task <ActionResult> AddOrUpdateDormitory([FromQuery] bool add, [FromQuery] int?dormitoryId)
        {
            var dormitoryRooms = await _dormitoryRoomService.GetRoomsWithoutDormitory();

            var faculties = await _facultyService.GetAll();

            var selectedDormitoryRooms = _dormitoryRoomSelectModelMapper.Map(dormitoryRooms).ToList();
            var selectedFaculties      = _facultySelectModelMapper.Map(faculties).ToList();

            DormitoryPostModel model;

            if (add)
            {
                model = new DormitoryPostModel();

                ViewBag.Header = ControllerConstants.AddDormitoryHeader;
            }
            else
            {
                var group = await _dormitoryService.GetById(dormitoryId.GetValueOrDefault());

                model = _dormitoryPostModelMapper.Map(group);

                foreach (var dormitoryRoom in selectedDormitoryRooms)
                {
                    if (model.DormitoryRooms.Contains(dormitoryRoom.DormitoryRoomId))
                    {
                        dormitoryRoom.Checked = true;
                    }
                }

                foreach (var faculty in selectedFaculties)
                {
                    if (model.Faculties.Contains(faculty.Id))
                    {
                        faculty.Checked = true;
                    }
                }

                ViewBag.Header = ControllerConstants.UpdateDormitoryHeader;
            }

            ViewBag.Faculties      = selectedFaculties;
            ViewBag.DormitoryRooms = selectedDormitoryRooms;

            return(View(model));
        }
Exemple #7
0
        public ActionResult Faculties()
        {
            List <DisplayFaculty> faculties = new List <DisplayFaculty>();

            foreach (var faculty in _faculty.GetAll())
            {
                faculties.Add(new DisplayFaculty
                {
                    Id              = faculty.Id,
                    Name            = faculty.Name,
                    Subjects        = _subject.GetSubjectsNamesEIE(faculty.FacultySubjects),
                    CountSpeciality = _specialty.GetByFacultyId(faculty.Id).Count()
                });
            }

            return(View(faculties));
        }
        //public IActionResult GetCurriculum()
        //{
        //    CurriculumsModel newModel = new CurriculumsModel();
        //    newModel.newList = _Service.GetAll().ToList();
        //    return View("~/Views/Curriculum/Curriculums.cshtml", newModel);
        //}

        //public async Task<IActionResult> AddNewCurriculum(AddCurriculumModel model)
        //{
        //    CurriculumDTO newItem = new CurriculumDTO()
        //    {
        //        Qualification = model.Qualification,
        //        NameSpecialization = model.nameSpecialization,
        //        NameEducationalDegree = model.nameEducationalDegree,
        //        NameForm_of_education = model.nameForm_of_education,
        //        TrainingPeriod = model.TrainingPeriod,
        //        BasedOn = model.BasedOn
        //    };

        //    await curriculum.Create(newItem);
        //    return RedirectToAction("VHome", "CurriculumDepartment");
        //}

        public IActionResult GetAddCurriculum()
        {
            AddCurriculumModel newModel = new AddCurriculumModel();

            newModel.newListSpecialization = specialization.GetAll().ToList().Select(x => new SelectListItem {
                Text = x.nameSpecialization, Value = x.nameSpecialization
            }).ToList();
            newModel.newListForm_of_education = formEducation.GetAll().ToList().Select(x => new SelectListItem {
                Text = x.FormEducationName, Value = x.FormEducationName
            }).ToList();
            newModel.newListEducationalDegree = educationalDegree.GetAll().ToList().Select(x => new SelectListItem {
                Text = x.EducationalDegreeName, Value = x.EducationalDegreeName
            }).ToList();
            newModel.newKnowledgeArea = knowledgeArea.GetAll().ToList().Select(x => new SelectListItem {
                Text = x.areaCode + "  " + x.areaName, Value = x.areaName
            }).ToList();
            newModel.newFaculty = faculty.GetAll().ToList().Select(x => new SelectListItem {
                Text = x.facultyName, Value = x.facultyName
            }).ToList();



            return(View("~/Views/CurriculumDepartment/Curriculum/AddCurriculum.cshtml", newModel));
        }
Exemple #9
0
        public ActionResult GetFaculty()
        {
            var faculties = _facultyService.GetAll();

            return(View(faculties));
        }
 // GET api/<controller>
 public List <FacultyDTO> Get()
 {
     return(facultyService.GetAll());
 }
        public async Task InitFaculties(dynamic viewBag)
        {
            var faculties = await _facultyService.GetAll();

            viewBag.Faculties = _facultySelectListItemMapper.Map(faculties).ToList();
        }
Exemple #12
0
 // GET: Admin/Users/Create
 public ActionResult Create()
 {
     ViewBag.FacultyId = new SelectList(_facultyService.GetAll(), "FacultyId", "FacultyName");
     ViewBag.GroupId   = new SelectList(_groupService.GetAll(), "GroupId", "GroupName");
     return(View());
 }
Exemple #13
0
 public ActionResult Index()
 {
     ViewBag.ListFaculties = _facultyService.GetAll().ToList();
     ViewBag.ID            = _userService.GetAll().OrderByDescending(x => x.UserId).Select(x => x.UserId).FirstOrDefault();
     return(View());
 }