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 Address for User public ActionResult AddresDetails() { string UserName = (string)Session["UserName"]; if (UserName == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Users user = searchOperation.GetUser(UserName); Student student = searchOperation.GetStudent(user.UserId); Address address = searchOperation.GetAddress(student.StudentId); District PerDistrict = searchOperation.GetDistrict((int)address.P_DistrictId); District TempDistrict = searchOperation.GetDistrict((int)address.T_DistrictId); AdressUpdateModel adressUpdateModel = new AdressUpdateModel(); adressUpdateModel.StudentId = address.StudentId; adressUpdateModel.Permanent_District_Name = PerDistrict.DistrictName; adressUpdateModel.Temporary_District_Name = TempDistrict.DistrictName; adressUpdateModel.Permanent_Post_Office = address.P_PostOffice; adressUpdateModel.Temporary_Post_Office = address.T_PostOffice; adressUpdateModel.Permanent_Village_Name = address.P_VillageName; adressUpdateModel.Temporary_Village_Name = address.T_VillageName; return(View(adressUpdateModel)); }