blob: 70ccacd1d5e354edc8d3df2b58acbbc3986712e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
namespace CrupestApi.Commons.Crud;
public static class CrudWebApplicationExtensions
{
public static WebApplication UseCrud<TEntity>(this WebApplication app, string path) where TEntity : class
{
app.MapGet(path, async (context) =>
{
var crudService = context.RequestServices.GetRequiredService<CrudService<TEntity>>();
});
app.MapPost(path, async (context) =>
{
var crudService = context.RequestServices.GetRequiredService<CrudService<TEntity>>();
});
return app;
}
}
|