using ECommerce.Model.Repositories; using ECommerce.Model.Entities; using Microsoft.AspNetCore.Mvc; namespace Ecommerce_web_project.Controllers; public class ImageController : Controller { private readonly IRepository _repo; public ImageController(IRepository repo) => _repo = repo; public async Task Product(Guid id) { var product = await _repo.GetByIdAsync(id); if (product?.ImageData == null || product.ImageContentType == null) return NotFound(); return File(product.ImageData, product.ImageContentType); } }