public ActionResult GetProjectByRegion(int?region = null, string searchString = "", int page = 1) { GetProjectWithConditionsRequest request = new GetProjectWithConditionsRequest() { Index = page, NumberOfResultsPerPage = Portal.Infractructure.Utility.Define.DISPLAY_PROJECT_PAGE_SIZE, ProgressStatus = null, ProjectType = null, Region = region, SearchString = searchString }; GetProjectWithConditionResponse response = service.GetAllProjectMatchingConditions(request); IPagedList <portal_Projects> pageProjects = new StaticPagedList <portal_Projects>(response.Projects, page, Portal.Infractructure.Utility.Define.DISPLAY_PROJECT_PAGE_SIZE, response.TotalProjects); if (region != null) { ViewBag.Category = EnumHelper.GetDescriptionFromEnum((Define.Region)region); ViewBag.CategoryValue = region; } else { ViewBag.Category = "All"; ViewBag.CategoryValue = null; } ViewBag.CategoryType = Portal.Infractructure.Utility.Define.CategoryType.Region; return(View("DisplayProjects", pageProjects)); }
public GetProjectWithConditionResponse GetAllProjectMatchingConditions(GetProjectWithConditionsRequest request) { IEnumerable <portal_Projects> foundProjects = GetMatchingConditionProjects(request); GetProjectWithConditionResponse response = new GetProjectWithConditionResponse() { CurrentPage = request.Index, SearchString = request.SearchString, TotalNumberOfPages = (int)Math.Ceiling((double)foundProjects.Count() / request.NumberOfResultsPerPage), TotalProjects = foundProjects.Count(), Projects = CropProjectListToSatisfyGivenIndex(foundProjects, request.Index, request.NumberOfResultsPerPage) }; return(response); }
public ActionResult Index(string searchString = "", int page = 1) { GetProjectWithConditionsRequest request = new GetProjectWithConditionsRequest() { Index = page, NumberOfResultsPerPage = Portal.Infractructure.Utility.Define.DISPLAY_PROJECT_PAGE_SIZE, ProgressStatus = null, ProjectType = null, Region = null, SearchString = searchString }; GetProjectWithConditionResponse response = service.GetAllProjectMatchingConditions(request); IPagedList <portal_Projects> pageProjects = new StaticPagedList <portal_Projects>(response.Projects, page, Portal.Infractructure.Utility.Define.DISPLAY_PROJECT_PAGE_SIZE, response.TotalProjects); ViewBag.Category = "All Project"; ViewBag.CategoryValue = null; ViewBag.CategoryType = Portal.Infractructure.Utility.Define.CategoryType.All; return(View("DisplayProjects", pageProjects)); }