Update to latest packages and show examples
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using GerstITS.Examples.Logic.Customers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GerstITS.Examples.Api.Endpoints;
|
||||
|
||||
internal static partial class Endpoints
|
||||
{
|
||||
internal static RouteGroupBuilder MapCustomerNoteEndpoints(this RouteGroupBuilder group)
|
||||
{
|
||||
CustomerNotes.MapGetByCustomer(group);
|
||||
CustomerNotes.MapAdd(group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
internal static class CustomerNotes
|
||||
{
|
||||
internal static void MapGetByCustomer(RouteGroupBuilder group)
|
||||
{
|
||||
group.MapGet("customers/{id:int}/notes", (int id, ICustomerProvider customerProvider) =>
|
||||
Results.Ok(customerProvider.GetNotes(id)));
|
||||
}
|
||||
|
||||
internal static void MapAdd(RouteGroupBuilder group)
|
||||
{
|
||||
group.MapPost("customers/{id:int}/notes", (int id, [FromBody] CustomerNote note, ICustomerProvider customerProvider) =>
|
||||
Results.Ok(customerProvider.AddNote(id, note.Text)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user