Skip to content

Instantly share code, notes, and snippets.

@alastairs
Last active May 16, 2017 19:27
Show Gist options
  • Save alastairs/60b73881e115f7c324419f3c4c06bb12 to your computer and use it in GitHub Desktop.
Save alastairs/60b73881e115f7c324419f3c4c06bb12 to your computer and use it in GitHub Desktop.
Example model binding
namespace Mvc.Examples
{
public class SomeController : Controller
{
public IActionResult Post([FromBody]MyModel model)
{
// Do something with `model` here
}
}
public class MyModel
{
public int Id { get; set; }
public string SomeProperty { get; set; }
// etc.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment