public JsonResult SearchProducts(string searchTerm, int pageNumber, string currencyCode) { var currency = ApplicationProperties.DefaultCurrency; Enum.TryParse(currencyCode, out currency); var productSearch = new ProductSearch( searchTerm, pageNumber, ApplicationProperties.NumberOfProductsOnPage, currency ); var productsOnCurrentPage = productSearch.GetProducts(); return Json(new { items = productsOnCurrentPage, pageNumber = pageNumber, totalPages = GetTotalNumberOfProductPages(productSearch) }); }