public ActionResult Index()
        {
            var personalAccountUser = AppUser.PersonalAccountUser;
            var details             = new PersonalDetailsVM();

            if (personalAccountUser.IMSEmployee != null)
            {
                details.FromIMSEmployee(personalAccountUser.IMSEmployee);
            }
            else if (personalAccountUser.ERSAIEmployee != null)
            {
                details.FromERSAIEmployee(personalAccountUser.ERSAIEmployee);
            }
            else
            {
                details = null;
            }

            SetAutoLogoutIfNoActivity(300);

            return(View(details));
        }
        public ActionResult EditPersonal(PersonalDetailsVM PersonalDetailsVM)
        {
            var studentVM = new StudentVM();

            studentVM.PersonalDetailsVM.SelectedCourseIds = PersonalDetailsVM.SelectedCourseIds;
            studentVM.PersonalDetailsVM.Courses           = new List <Course>();
            foreach (var id in studentVM.PersonalDetailsVM.SelectedCourseIds)
            {
                studentVM.PersonalDetailsVM.Courses.Add(CourseRepository.Get(id));
            }

            if (ModelState.IsValid)
            {
                var student = new Student();
                student.StudentId = PersonalDetailsVM.StudentId;
                student.FirstName = PersonalDetailsVM.FirstName;
                student.LastName  = PersonalDetailsVM.LastName;
                student.GPA       = PersonalDetailsVM.GPA;
                student.Major     = MajorRepository.Get(PersonalDetailsVM.MajorId);
                student.Courses   = studentVM.PersonalDetailsVM.Courses;
                StudentRepository.Edit(student);
                return(RedirectToAction("List"));
            }
            else
            {
                studentVM.AddressDetailsVM.StudentId  = PersonalDetailsVM.StudentId;
                studentVM.PersonalDetailsVM.StudentId = PersonalDetailsVM.StudentId;
                studentVM.PersonalDetailsVM.FirstName = PersonalDetailsVM.FirstName;
                studentVM.PersonalDetailsVM.LastName  = PersonalDetailsVM.LastName;
                studentVM.PersonalDetailsVM.GPA       = PersonalDetailsVM.GPA;
                studentVM.PersonalDetailsVM.SetCourseItems(CourseRepository.GetAll());
                studentVM.PersonalDetailsVM.SetMajorItems(MajorRepository.GetAll());
                studentVM.AddressDetailsVM.SetStateItems(StateRepository.GetAll());
                var getstudent = StudentRepository.Get(PersonalDetailsVM.StudentId);
                studentVM.AddressDetailsVM.Address = getstudent.Address;
                return(View("Edit", studentVM));
            }
        }