Skip to content

Instantly share code, notes, and snippets.

@alexjamesbrown
Last active December 15, 2018 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexjamesbrown/e8045d654db8bc6411baa341610b8c5f to your computer and use it in GitHub Desktop.
Save alexjamesbrown/e8045d654db8bc6411baa341610b8c5f to your computer and use it in GitHub Desktop.
public class CustomerController : Controller
{
private ICustomerService _customerService;
public CustomerController(ICustomerService customerService)
{
_customerService = customerService;
}
public IActionResult Post(string firstName, string lastName)
{
var customer = new Customer
{
FirstName = firstName,
LastName = lastName
};
var customerId = customerService.Save(customer);
return Created("/customer/" + customerId, customer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment