using Core.Abstractions.Models; using Core.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using WeatherForecast.Models; using WeatherForecast.Models.Responses; namespace WeatherForecast.Controllers; [AllowAnonymous] [ApiController] [Route("api/[controller]")] public class ShopCatalogController : ControllerBase { private readonly ILogger _logger; public ShopCatalogController(ILogger logger) { _logger = logger; } /// /// /// /// /// /// /// /// [HttpGet] public IActionResult Get([FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int currentPage = 1, [FromQuery] int itemsPerPage = 8) { var shopModels = new List(); for (int i = 0; i < 8; i++) { var shopItemModel = new ShopItemModel { Id = Guid.NewGuid(), Sku = "SKU-0", Slug = "shop-catalog-item", Image = new ImageModel { Src = "https://dummyimage.com/450x300/dee2e6/6c757d.jpg", Alt = "..." }, Badge = "sale", Title = "Shop item title", ShortText = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...", Text = "", Author = new AuthorModel { Id = Guid.NewGuid(), Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." }, NickName = "Admin" }, Created = DateTime.UtcNow, Tags = new List { "react", "redux", "webapi" }, Rating = 4.5, Price = 20, NewPrice = 10 }; shopModels.Add(shopItemModel); } var shopCatalogResponse = new GetShopCatalogResponseModel { ShopItemsPagination = new PaginationModel { CurrentPage = currentPage, TotalPages = 100, Items = shopModels } }; return Ok(shopCatalogResponse); } }