using API.DTO.Material.Response; using FastEndpoints; using Microsoft.EntityFrameworkCore; namespace API.Endpoints.Material; public class GetAllMaterialsEndpoint(AppDbContext appDbContext) : EndpointWithoutRequest> { public override void Configure() { Get("/material"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) { List responseDto = await appDbContext.Materials .Select(a => new GetMaterialDto { Id = a.Id, Name = a.Name, Quantity = a.Quantity, WarehouseId = a.WarehouseId, } ).ToListAsync(ct); await Send.OkAsync(responseDto, ct); } }