public ActionResult Profile() { string UserName = (string)Session["UserName"]; if (UserName == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SearchOperation searchOperation = new SearchOperation(); Users user = searchOperation.GetUser(UserName); Student student = searchOperation.GetStudent(user.UserId); Address address = searchOperation.GetAddress(student.StudentId); District parDistrict = searchOperation.GetDistrict((int)address.P_DistrictId); District TemDistrict = searchOperation.GetDistrict((int)address.T_DistrictId); DepartmentInfo departmentInfo = searchOperation.GetDepartmentInfo(student.StudentId); Department department = searchOperation.GetDepartment((int)departmentInfo.DepartmentId); Room room = searchOperation.GetRoom((int)student.RoomId); UserProfileModel userProfileModel = new UserProfileModel(); userProfileModel.StudentName = student.StudentName; userProfileModel.FatherName = student.FatherName; userProfileModel.MotherName = student.MotherName; userProfileModel.MobileNumber = student.MobileNumber; userProfileModel.ParmanentDistrict = parDistrict.DistrictName; userProfileModel.ParmanentPostOfiice = address.P_PostOffice; userProfileModel.ParmanentVillage = address.P_VillageName; userProfileModel.TemporaryDistrict = TemDistrict.DistrictName; userProfileModel.TemporaryPostOfiice = address.T_PostOffice; userProfileModel.TemporaryVillage = address.T_VillageName; userProfileModel.DepartmentName = department.DeptName; userProfileModel.Session = departmentInfo.Session; userProfileModel.Cgpa = departmentInfo.Cgpa; userProfileModel.RoomNumber = (int)room.RoomNumber; return(View(userProfileModel)); }
// To show the all details of Student for User public ActionResult StudentDetails() { string UserName = (string)Session["UserName"]; if (UserName == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Users user = searchOperation.GetUser(UserName); Student student = searchOperation.GetStudent(user.UserId); Room room = searchOperation.GetRoom((int)student.RoomId); DepartmentInfo departmentInfo = searchOperation.GetDepartmentInfo(student.StudentId); StudentUpdateModel studentUpdateModel = new StudentUpdateModel(); studentUpdateModel.StudentId = departmentInfo.StudentId; studentUpdateModel.StudentName = student.StudentName; studentUpdateModel.FatherName = student.FatherName; studentUpdateModel.MotherName = student.MotherName; studentUpdateModel.MobileNumber = student.MobileNumber; studentUpdateModel.RoomNumber = (int)room.RoomNumber; return(View(studentUpdateModel)); }