suppr all 'var' and Models.xxx. And added 's' at the end of all directories endpoints
This commit is contained in:
30
PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
Normal file
30
PyroFetes/Endpoints/Users/GetAllUsersEndpoint.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.User.Response;
|
||||
|
||||
namespace PyroFetes.Endpoints.Users;
|
||||
|
||||
public class GetAllUsersEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetUserDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/users");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
List<GetUserDto> users = await database.Users
|
||||
.Select(users => new GetUserDto()
|
||||
{
|
||||
Id = users.Id,
|
||||
Name = users.Name,
|
||||
Password = users.Password,
|
||||
Salt = users.Salt,
|
||||
Email = users.Email,
|
||||
Fonction = users.Fonction
|
||||
})
|
||||
.ToListAsync(ct);
|
||||
|
||||
await Send.OkAsync(users, ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user