private IHttpActionResult getProduct(string slug, string productBadge, [FromUri] CategoryPageParameterModel parameter) { var pagination = new PaginationMetadataModel() { currentPage = parameter.pageNumber, pageSize = parameter.pageSize }; var filter = new CategoryPageFilterModel() { categorySlug = slug, productBadge = productBadge, priceMin = parameter.priceMin, priceMax = parameter.priceMax, sort = parameter.sort }; var products = _service.getProducts(filter, ref pagination); if (products == null || products.Count == 0) { return(NotFound()); } // Setting Header HttpContext.Current.Response.Headers.Add("Access-Control-Expose-Headers", "X-Paging-Headers"); HttpContext.Current.Response.Headers.Add("X-Paging-Headers", JsonConvert.SerializeObject(pagination)); // Returing List of product Collections return(Ok <List <ProductCardModel> >(products)); }
public IHttpActionResult GetProductByCategory(string slug, [FromUri] CategoryPageParameterModel parameter) { return(this.getProduct(slug, String.Empty, parameter)); }
public IHttpActionResult GetProductOrderByCategory(string slug, string productBadge, [FromUri] CategoryPageParameterModel parameter) { return(this.getProduct(slug, productBadge, parameter)); }
public IHttpActionResult GetProductOrderAll(string productBadge, [FromUri] CategoryPageParameterModel parameter) { return(this.getProduct(String.Empty, productBadge, parameter)); }
public IHttpActionResult GetProductAll([FromUri] CategoryPageParameterModel parameter) { return(this.getProduct(String.Empty, String.Empty, parameter)); }