Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class CustomerModule : BotwinModule
{
public CustomerModule()
{
Get("/customers/{customerId:Guid}", async (request, response, routeData) =>
{
var customer = await CustomerStateService.GetCustomer(Guid.Parse(routeData.Values["customerId"].ToString()));
await response.Negotiate(customer);
});
Post("/customers", async (request, response, _) =>
{
var customerId = Guid.NewGuid();
await CustomerStateService.CreateCustomer(customerId, "CodeOpinion");
response.StatusCode = 201;
response.Headers.Add(new KeyValuePair<string, StringValues>("Location", $"/customers/{customerId}"));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment