// // GET: /Major/Get/ public ActionResult Get() { if (HttpContext != null) { UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext); ViewBag.breadCrumbData = "<a href='" + url.Action("Get", "Major") + "'>Get Major</a>"; ViewBag.breadCrumbData += " > Get"; } PLMajor major = new PLMajor(); return(View("Get", major)); }
// // GET: /Major/Edit/ public ActionResult Edit(string id) { if (HttpContext != null) { UrlHelper url = new UrlHelper(HttpContext.Request.RequestContext); ViewBag.breadCrumbData = "<a href='" + url.Action("Edit", "Major") + "'>Edit Major</a>"; ViewBag.breadCrumbData += " > Edit"; } PLMajor major = MajorClientService.GetMajorDetail(Convert.ToInt32(id)); return(View("Edit", major)); }
public ActionResult Edit(FormCollection collection) { try { PLMajor major = new PLMajor(); major.major_id = Convert.ToInt32(collection["major_id"]); major.major_name = collection["major_name"]; major.dept_id = Convert.ToInt32(collection["dept_id"]); MajorClientService.UpdateMajor(major); return(RedirectToAction("Edit")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { PLMajor major = new PLMajor(); major.major_id = Convert.ToInt32(collection["major_id"]); major.major_name = collection["major_name"]; major.dept_id = Convert.ToInt32(collection["dept_id"]); MajorClientService.InsertMajor(major); return(RedirectToAction("Create")); } catch (Exception e) { Console.Write(e.ToString()); return(View()); } }
// // 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")); }