Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created January 25, 2018 02:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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