public ActionResult EditStudentInfo(Guid id) { //State List <State> listState = new List <State>(); listState = DropdownService.GetState(); GetState(listState); //City List <City> listCity = new List <City>(); listCity = DropdownService.GetCity(); GetCity(listCity); //College List <College> listCollege = new List <College>(); listCollege = DropdownService.GetCollege(); GetCollege(listCollege); //Department List <Department> listDepartment = new List <Department>(); listDepartment = DropdownService.GetDepartment(); GetDepartment(listDepartment); studentToEdit = new StudentModel(); studentToEdit = StudentServiceTest.GetStudent(id); return(View(studentToEdit)); }
public ActionResult DisplayStudent(string email) { StudentModel studentModel = StudentServiceTest.GetStudentByEmail(email); TempData["FullName"] = studentModel.FullName; ViewBag.Name = studentModel.FirstName; return(RedirectToAction("ViewStudentInfo", new { id = studentModel.StudentID })); }
public ActionResult StudentInfo() { List <StudentInfoModel> newList = new List <StudentInfoModel>(); newList = StudentServiceTest.GetStudents(); var check = TempData["toast"]; return(View(newList)); }
public ActionResult ViewStudentHistory(Guid studentId) { List <StudentHistoryModel> historyList = new List <StudentHistoryModel>(); historyList = StudentServiceTest.GetStudentHistory(studentId); ViewBag.Name = TempData["FullName"]; return(View(historyList)); }
public ActionResult ViewStudentInfo(Guid id) { StudentModel studentModel = StudentServiceTest.GetStudent(id); if (studentModel == null) { return(RedirectToAction("StudentInfo")); } TempData["FullName"] = studentModel.FullName; ViewBag.Name = studentModel.FirstName; return(View(studentModel)); }
public ActionResult DeleteStudent(Guid id) { if (StudentServiceTest.DeleteStudent(id)) { TempData["toast"] = "Student Deleted Successfully"; return(RedirectToAction("StudentInfo")); } else { ModelState.AddModelError("DeleteFailedError", "Error in deleting the student. The Administrator has been notified"); return(this.View()); } }
public ActionResult AddStudentInfo(StudentModel studentModel) { if (ModelState.IsValid) { ErrorEnums insertCheck = StudentServiceTest.InsertStudent(studentModel); string errorString = GetError.GetErrorFromEnum(insertCheck); if (errorString.Equals("Added Successfully")) { TempData["toastError"] = errorString; return(RedirectToAction("StudentInfo")); } else { TempData["toastError"] = errorString; return(this.View()); } //if (insertCheck == ErrorEnums.Successful) //{ // TempData["toast"] = "Student Added successfully"; // return RedirectToAction("StudentInfo"); //} //else if(insertCheck == ErrorEnums.EmailAddress) //{ // ModelState.AddModelError("AddFailedError", "Error in adding the student. The Email Address should be unique"); // return this.View(); //} //else if(insertCheck == ErrorEnums.PhoneNumber) //{ // ModelState.AddModelError("AddFailedError", "Error in adding the student. The Contact Number should be unique"); // return this.View(); //} //else if(insertCheck == ErrorEnums.Code) //{ // ModelState.AddModelError("AddFailedError", "Error in adding the student. The Student Code should be unique"); // return this.View(); //} //else //{ // ModelState.AddModelError("AddFailedError", "Error in adding the student. The Student Code, Email Address and the Contact Number should be unique"); // return this.View(); //} } else { return(this.View()); } }
public ActionResult EditStudentInfo(StudentModel model) { model.StudentID = studentToEdit.StudentID; model.EmailAddress = studentToEdit.EmailAddress; model.StudentCode = studentToEdit.StudentCode; if (!ModelState.IsValid) { return(this.View()); } if (StudentServiceTest.UpdateStudent(model)) { TempData["toast"] = "Student Edited Successfully"; return(RedirectToAction("StudentInfo")); } else { ModelState.AddModelError("UpdateFailedError", "Error in updating the student. The Student Code, Email Address and the Contact Number should be unique"); return(this.View()); } }