public ActionResult ChangePassword(string id, FormCollection collection) { PLStudent student = StudentClientService.GetStudentDetail(id);//new PLStudent(); if (collection.Count == 0) { return(View("ChangePassword", student)); } try { //PLStudent student = StudentClientService.GetStudentDetail(collection["ID"]);//new PLStudent(); student.Password = collection["Password"]; StudentClientService.UpdateStudent(student); return(RedirectToAction("Index"));// this brings us to the student List page } catch (Exception e) { Console.Write(e.ToString()); return(RedirectToAction("Error")); } //return View("ChangePassword", student); }
public ActionResult Edit(string id, FormCollection collection) { try { PLStudent student = new PLStudent(); student.ID = id;//collection["ID"]; student.FirstName = collection["FirstName"]; student.LastName = collection["LastName"]; student.SSN = collection["SSN"]; student.EmailAddress = collection["EmailAddress"]; student.Password = collection["Password"]; student.ShoeSize = float.Parse(collection["ShoeSize"]); student.Weight = Convert.ToInt32(collection["Weight"]); student.StudentLevel = collection["StudentLevel"]; student.Major = Convert.ToInt32(collection["Major"]); student.Status = Convert.ToInt32(collection["Status"]); StudentClientService.UpdateStudent(student); return(RedirectToAction("Index")); } catch { return(View("Error")); } }
// // GET: /StudentHome/ public ActionResult Index() { if (Session["role"] != null) { if (Session["role"].Equals("student")) { PLStudent student = StudentClientService.GetStudentDetail(Session["id"].ToString()); PLMajor major = MajorClientService.GetMajorDetail(student.Major); PLDepartment department = new PLDepartment(); List <PLDepartment> departmentList = DepartmentClientService.GetDepartmentList(); foreach (PLDepartment dept in departmentList) { if (dept.ID == major.dept_id) { department = dept; break; } } string studentName = student.LastName + ", " + student.FirstName; string majorName = major.major_name; string departmentName = department.deptName; string studentLevel = ""; switch (Convert.ToInt32(student.StudentLevel)) { case 0: studentLevel = "freshman"; break; case 1: studentLevel = "sophomore"; break; case 2: studentLevel = "junior"; break; case 3: studentLevel = "senior"; break; case 4: studentLevel = "grad"; break; case 5: studentLevel = "phd"; break; } string studentStatus = ""; switch (Convert.ToInt32(student.Status)) { case 0: studentStatus = "Good Standing"; break; case 1: studentStatus = "Probation"; break; case 2: studentStatus = "Subject for Disqualification"; break; case 3: studentStatus = "Disqualification"; break; } ViewData["studentName"] = studentName; ViewData["studentSSN"] = student.SSN; ViewData["studentEmail"] = student.EmailAddress; ViewData["studentShoeSize"] = student.ShoeSize; ViewData["studentWeight"] = student.Weight; ViewData["studentLevel"] = studentLevel; ViewData["studentStatus"] = studentStatus; ViewData["majorName"] = majorName; ViewData["departmentName"] = departmentName; return(View()); } } return(View("Error")); }