27 lines
790 B
C#
27 lines
790 B
C#
namespace PyroFetes.Endpoints.Setting;
|
|
using PyroFetes.DTO.SettingDTO.Request;
|
|
using PyroFetes.DTO.SettingDTO.Response;
|
|
using FastEndpoints;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
public class GetAllSettingEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetSettingDto>>
|
|
{
|
|
public override void Configure()
|
|
{
|
|
Get("/api/setting");
|
|
}
|
|
|
|
public override async Task HandleAsync(CancellationToken ct)
|
|
{
|
|
var setting = await database.Settings
|
|
.Select(setting => new GetSettingDto()
|
|
{
|
|
Id = setting.Id,
|
|
ElectronicSignature = setting.ElectronicSignature,
|
|
Logo = setting.Logo
|
|
})
|
|
.ToListAsync(ct);
|
|
|
|
await Send.OkAsync(setting, ct);
|
|
}
|
|
} |