public ActionResult Admin(int?page, string Tab = null, string sortingOrder = "RecentlyPosted", string searchText = "") { searchText = searchText.Replace("'", "''"); Serialization serialization = new Serialization(); DashboardWrapper dashboardWrapper = new DashboardWrapper(); Hashtable HashCriteria = new Hashtable(); Hashtable UsersHashCriteria = new Hashtable(); Hashtable ResourcesHashCriteria = new Hashtable(); Hashtable TestimonialsHashCriteria = new Hashtable(); string actualCriteria; actualCriteria = serialization.SerializeBinary((object)HashCriteria); int pageSize = 8; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; if (Tab == "Users") { UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("Name", searchText); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminUsersTab", dashboardWrapper.PagedListUsers)); } else if (Tab == "Resources") { Learn learnBA = new Learn(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("SearchText", searchText); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminResourcesTab", dashboardWrapper.PagedListResource)); } else if (Tab == "Testimonials") { Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminTestimonialsTab", dashboardWrapper.PagedListTestimonial)); } else { InvestorListings investorListings = new InvestorListings(); InvestorListingWrapper investorListingWrapper = new InvestorListingWrapper(); investorListingWrapper.SortingOrder = sortingOrder; investorListingWrapper.ListingTypeIds = string.Empty; HashCriteria.Add("ID", investorListingWrapper.ListingTypeIds); HashCriteria.Add("LocationName", investorListingWrapper.LocationName); HashCriteria.Add("SortingOrder", investorListingWrapper.SortingOrder); HashCriteria.Add("Name", searchText); HashCriteria.Add("LoanID", investorListingWrapper.LoanID); HashCriteria.Add("LienPositionID", investorListingWrapper.LienPositionID); HashCriteria.Add("LoanStatusID", investorListingWrapper.LoanStatusID); HashCriteria.Add("State", investorListingWrapper.State); HashCriteria.Add("LoanTypeID", investorListingWrapper.LoanTypeID); HashCriteria.Add("Address", investorListingWrapper.Address); HashCriteria.Add("PropertyTypeID", investorListingWrapper.PropertyTypeID); HashCriteria.Add("MinPrincipalBalance", 0); HashCriteria.Add("MaxPrincipalBalance", 0); HashCriteria.Add("City", investorListingWrapper.City); HashCriteria.Add("MinInterestRate", 0); HashCriteria.Add("MaxInterestRate", 0); HashCriteria.Add("MinAskingPrice", 0); HashCriteria.Add("MaxAskingPrice", 0); HashCriteria.Add("UserID", userID); actualCriteria = serialization.SerializeBinary((object)HashCriteria); var listing = investorListings.GetDealDetails(actualCriteria); dashboardWrapper.InvestorAdminListing = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(listing))); dashboardWrapper.PagedListAdminListings = dashboardWrapper.InvestorAdminListing.ToPagedList(pageIndex, pageSize); //Users default load actualCriteria = string.Empty; UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); dashboardWrapper.Users = new List <UserProfileEditModel>(); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); //Resources default load actualCriteria = string.Empty; Learn learnBA = new Learn(); //For Learn LearnModel learn = new LearnModel(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); if (Tab != null) { return(PartialView("_AdminListingsTab", dashboardWrapper.PagedListAdminListings)); } return(View("AdminDashboard", dashboardWrapper)); } }