forked from sanchezvem/PyroFetes
Ajout de Login et du model réuni avec tout les autres Sujet
This commit is contained in:
30
PyroFetes/Endpoints/Login/GetAllLoginEndpoint.cs
Normal file
30
PyroFetes/Endpoints/Login/GetAllLoginEndpoint.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user