using Infrastucture.Data; using Core.Entities; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace API.Controllers { [ApiController] [Route("api/[controller]")] public class ProductsController : ControllerBase { private readonly StoreContext _context; public ProductsController(StoreContext context) { _context = context; } [HttpGet] public async Task>> GetProducts() { var products = await _context.Products.ToListAsync(); return Ok(products); } [HttpGet("{id}")] public async Task> GetProduct(int id) { return await _context.Products.FindAsync(id); } } }