-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyEndpoint.cs
37 lines (28 loc) · 940 Bytes
/
MyEndpoint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SeperateConcernsLogger.Utilities;
using Serilog;
using Serilog.Context;
namespace SeperateConcernsLogger;
public class MyEndpoint : Endpoint<MyRequest>
{
public override void Configure()
{
Post("/api/user/create");
AllowAnonymous();
}
public override async Task HandleAsync(MyRequest req, CancellationToken ct)
{
var response = new MyResponse()
{
FullName = req.FirstName + " " + req.LastName,
IsOver18 = req.Age > 18
};
///Create islemleride kullanilir
WLogger.Create(existing_data: req, userId: req.UserId);
///Create islemlerinde hata oldugu zaman kullanilir
WLogger.Create(existing_data: req, userId: req.UserId, errorMessage: "");
///Update ve delete islemleri icin de ayni mantikla kullanilir.
await SendAsync(response);
}
}