//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)); }
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)); }
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)); }
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)); }
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)); }
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")); }
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)); }
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)); }