forked from sanchezvem/PyroFetes
30 lines
809 B
C#
30 lines
809 B
C#
using PyroFetes.DTO.Login.Response;
|
|
using FastEndpoints;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using PyroFetes;
|
|
|
|
namespace PyroFetes.Endpoints.Login;
|
|
|
|
public class GetAllLoginEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetLoginDto>>
|
|
{
|
|
public override void Configure()
|
|
{
|
|
Get("/api/logins");
|
|
}
|
|
|
|
public override async Task HandleAsync(CancellationToken ct)
|
|
{
|
|
var logins = await database.Logins
|
|
.Select(login => new GetLoginDto()
|
|
{
|
|
Id = login.Id,
|
|
Username = login.Username,
|
|
FullName = login.FullName,
|
|
Password = login.Password,
|
|
Salt = login.Salt
|
|
})
|
|
.ToListAsync(ct);
|
|
|
|
await Send.OkAsync(logins, ct);
|
|
}
|
|
} |