Ejemplo n.º 1
0
        //public ActionResult ChangePassword(ChangePassword newPassword)
        public ActionResult ChangePassword(FormCollection form)
        {
            var     oldPwd       = form["OldPassword"];
            var     oldPwdHash   = PasswordGenerator.HashPassword(oldPwd);
            var     newPwd       = form["newPassword"];
            string  userCategory = string.Empty;
            UCMUser user         = new UCMUser();

            if (StaticVariables.Role.Equals("Student"))
            {
                userCategory = "Student";
                user         = StaticVariables.StudentDetails.FirstOrDefault(p => p.Id == int.Parse(User.Identity.Name));
            }
            else
            {
                userCategory = "Advisor";
                user         = StaticVariables.AdvisorDetails.FirstOrDefault(p => p.Id == Convert.ToInt32(User.Identity.Name));
            }
            if (oldPwdHash.Equals(user.Password))
            {
                var newPwdHash = PasswordGenerator.HashPassword(newPwd);
                user.Password = newPwdHash;
                bool updateStatus = ContactApi.PostToApi <UCMUser>(user, "updateUser");
                if (updateStatus)
                {
                    return(RedirectToAction(userCategory, "Home"));
                }
            }
            return(View());
        }
        public ActionResult EditStudentDetails(StudentData studentData)
        {
            var  Student = updateData(studentData);
            bool status  = ContactApi.PostToApi <UCMStudent>(Student, "updateStudent");

            if (status)
            {
                studentData = new StudentData();
            }
            return(View(studentData));
        }
        public ActionResult EditStudentAdvising(StudentAdvisingData data)
        {
            var  studentDetails = updateStudentDetails(data);
            bool status         = ContactApi.PostToApi <UCMStudent>(studentDetails, "updateStudent");

            if (status)
            {
                return(View(new StudentAdvisingData()));
            }
            return(View(data));
        }
Ejemplo n.º 4
0
        public ActionResult AddCourse(Course course)
        {
            bool added = ContactApi.PostToApi <Course>(course, "addCourse");

            if (added)
            {
                ModelState.Clear();
                StaticVariables.Courses.Add(course);
                return(View(new ViewModels.CourseInfo()));
            }
            return(View(course));
        }
Ejemplo n.º 5
0
        public ActionResult CreatePassword(int id)
        {
            UCMUser user        = StaticVariables.AdvisorDetails.FirstOrDefault(p => p.Id == id);
            string  password    = PasswordGenerator.GeneratePassword();
            string  md5Password = PasswordGenerator.HashPassword(password);

            user.Password = md5Password;
            bool status = ContactApi.PostToApi(user, "updateUser");

            ViewBag.Status = status;
            return(View());
        }
        public ActionResult EditConcentration(ViewProgram viewProgram)
        {
            Program program = StaticVariables.Programs.FirstOrDefault(p => p.Id == viewProgram.Id);

            populateProgramDetails(program, viewProgram);
            bool status = ContactApi.PostToApi <Program>(program, "updateProgram");

            if (status)
            {
                return(RedirectToAction("EditConcentrationList"));
            }
            return(View(viewProgram));
        }
Ejemplo n.º 7
0
        public ActionResult UpdateAdvisorData(AdvisorData data)
        {
            var details = StaticVariables.AdvisorDetails.FirstOrDefault(p => p.Id == data.AdvisorId);

            UpdateAdvisorDetails(details, data);
            bool status = ContactApi.PostToApi <UCMModerator>(details, "updateAdvisor");

            if (status)
            {
                return(RedirectToAction("UpdateAdvisor"));
            }
            return(View(data));
        }
        public ActionResult AddConcentration(ViewProgram viewProgram)
        {
            Program program = new Program();

            populateProgramDetails(program, viewProgram);
            bool status = ContactApi.PostToApi(program, "AddProgram");

            if (status)
            {
                ModelState.Clear();
                viewProgram = new ViewProgram();
            }
            return(View(viewProgram));
        }
Ejemplo n.º 9
0
        public ActionResult AddPrereqs(Course courseInfo)
        {
            Course course = StaticVariables.Courses.FirstOrDefault(p => p.Id == courseInfo.Id);

            course.PreqId         = courseInfo.PreqId;
            course.PrereqIsActive = courseInfo.PrereqIsActive;
            bool status = ContactApi.PostToApi <Course>(course, "updateCourse");

            if (status)
            {
                return(RedirectToAction("GetCourse"));
            }
            return(View(course));
        }
Ejemplo n.º 10
0
        public ActionResult ACCCompleted()
        {
            int        id      = Convert.ToInt32(User.Identity.Name);
            UCMStudent student = StaticVariables.StudentDetails.FirstOrDefault(p => p.Id == id);

            student.StudentTrainingStatusId = 3;
            bool status = ContactApi.PostToApi(student, "updateStudent");

            if (status)
            {
                return(RedirectToAction("Student"));
            }
            return(RedirectToAction("AcademicCodeOfConduct"));
        }
Ejemplo n.º 11
0
        public ActionResult AddAdvisor(AdvisorData advisorData)
        {
            UCMModerator details = new UCMModerator();

            populateAdvisorDetails(details, advisorData);
            bool added = ContactApi.PostToApi <UCMModerator>(details, "addAdvisor");

            if (added)
            {
                ModelState.Clear();
                StaticVariables.AdvisorDetails.Add(details);
                return(View(new AdvisorData()));
            }
            return(View(advisorData));
        }
Ejemplo n.º 12
0
        public async Task <ActionResult> AddStudent(StudentData data)
        {
            string     password    = PasswordGenerator.GeneratePassword();
            string     md5Password = PasswordGenerator.HashPassword(password);
            UCMStudent student     = new UCMStudent();

            populateUCMStudent(student, data, md5Password);
            bool postStatus = ContactApi.PostToApi <UCMStudent>(student, "addStudent");

            if (postStatus)
            {
                await GenerateEmail(data, password);

                ModelState.Clear();
            }
            return(View(data));
        }