Skip to content

Instantly share code, notes, and snippets.

@bruceharrison1984
Last active September 5, 2019 04:42
Show Gist options
  • Save bruceharrison1984/1c5b5b52d2a0cb33ce9d94bbd535d331 to your computer and use it in GitHub Desktop.
Save bruceharrison1984/1c5b5b52d2a0cb33ce9d94bbd535d331 to your computer and use it in GitHub Desktop.
Azure Functions FluentValidation
public async Task<IActionResult> PostWidget(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "widgets")] Models.Widget item, ILogger log)
{
log.LogInformation($"posting widget: ${item.Id}");
var newItem = await _dbContext.Widgets.AddAsync(item);
await _dbContext.SaveChangesAsync();
return new OkObjectResult(newItem.Entity);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment