public WebConfig() { Pagination = new PaginationContent(); MailServer = new MailServerContent(); Jwt = new JwtContent(); DateTimeFormat = new DateTimeFormatContent(); }
public static PaginationContent ObtainPaginationContent(Models.Pagination Model, string url) { // PaginationContent paginationContent = new PaginationContent(); int index = 1; //build base url for navigation links paginationContent.baseUri = new Uri(url); // this gets all the query string key value pairs as a collection paginationContent.queryString = HttpUtility.ParseQueryString(paginationContent.baseUri.Query); // this removes the key if exists paginationContent.queryString.Remove("pageNo"); paginationContent.queryString.Add("pageNo", ""); // this gets the page path from root without QueryString paginationContent.baseUrl = paginationContent.baseUri.GetLeftPart(UriPartial.Path); paginationContent.baseUrl = paginationContent.queryString.Count > 0 ? String.Format("{0}?{1}", paginationContent.baseUrl, paginationContent.queryString) : paginationContent.baseUrl; //Set values for page indexes paginationContent.previous = Model.pageNo - 1; paginationContent.next = Model.pageNo + 1; //Determine if prev/next values are correct. if (paginationContent.previous < 1) { paginationContent.previous = 1; } if (paginationContent.next > Model.totalPages) { paginationContent.next = Model.totalPages; } return(paginationContent); }