Hi everyone, I have a problem I'm trying to recover all the products with the following function but I am returning a null value. Can anyone tell me how to do it?
using Nop.Services.Catalog;
public partial class TopicController : BasePublicController
{
private readonly IProductService _productService;
public virtual IActionResult ListProd(int topicId)
{
var categoryIds = new List<int>();
categoryIds.Add(1); //categoryId - ID of the desired category
var products = _productService.SearchProducts(categoryIds: categoryIds);
ViewBag.MyList = products;
return products;
}
}