Files
eShopOnWeb-chisel-demo/src/Web/Controllers/Api/CatalogController.cs
Eric Fleming 555c3295f1 Renaming CatalogServices to CatalogViewModelService
- I believe this causes some confusion when people see "Service" in the Web project. We have another service in there named BasketViewModelService instead of BasketService anyways. Adding "ViewModel" to the name is a better representation of what the "services" in the Web project represent.
2019-03-30 15:29:32 -04:00

22 lines
807 B
C#

using Microsoft.eShopWeb.Web.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Microsoft.eShopWeb.Web.Controllers.Api
{
public class CatalogController : BaseApiController
{
private readonly ICatalogViewModelService _catalogViewModelService;
public CatalogController(ICatalogViewModelService catalogViewModelService) => _catalogViewModelService = catalogViewModelService;
[HttpGet]
public async Task<IActionResult> List(int? brandFilterApplied, int? typesFilterApplied, int? page)
{
var itemsPage = 10;
var catalogModel = await _catalogViewModelService.GetCatalogItems(page ?? 0, itemsPage, brandFilterApplied, typesFilterApplied);
return Ok(catalogModel);
}
}
}