32 lines
743 B
C#
32 lines
743 B
C#
using FastEndpoints;
|
|
using Knots.DTO.Discussion;
|
|
using Knots.DTO.User;
|
|
|
|
namespace Knots.Endpoints.Discussion;
|
|
|
|
public class CreateUserEndpoint(KnotsDbContext knotsDbContext) : Endpoint<CreateDiscussionDto, GetDiscussionDto>
|
|
{
|
|
public override void Configure()
|
|
{
|
|
Post("/users");
|
|
AllowAnonymous();
|
|
}
|
|
|
|
public override async Task HandleAsync(CreateDiscussionDto req, CancellationToken ct)
|
|
{
|
|
Models.Discussion discussion = new()
|
|
{
|
|
|
|
};
|
|
knotsDbContext.Add(discussion);
|
|
await knotsDbContext.SaveChangesAsync(ct);
|
|
|
|
GetDiscussionDto response = new()
|
|
{
|
|
Id = discussion.Id,
|
|
};
|
|
|
|
await Send.OkAsync(response, ct);
|
|
|
|
}
|
|
} |