using Core.Entities; using Microsoft.AspNetCore.Mvc; using Core.Interfaces; namespace API.Controllers { [ApiController] [Route("api/[controller]")] public class ProductsController : ControllerBase { private readonly iProductRepository _repo; public ProductsController(iProductRepository repo) { _repo = repo; } [HttpGet] public async Task>> GetProducts() { var products = await _repo.GetProductsAync(); return Ok(products); } [HttpGet("{id}")] public async Task> GetProduct(int id) { return await _repo.GetProductByIdAsync(id); } } }