Skip to content

Instantly share code, notes, and snippets.

@rsleggett
Created October 28, 2014 18:37
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 rsleggett/3d8d6e168f27bb548a15 to your computer and use it in GitHub Desktop.
Save rsleggett/3d8d6e168f27bb548a15 to your computer and use it in GitHub Desktop.
[PluginController("ClientAdministrationSection")]
public class ClientApiController : UmbracoAuthorizedJsonController
{
public ClientApiController()
{
int i = 0; // for testing only
}
public IEnumerable<Client> Getall()
{
var repository = new ClientRepository();
return repository.GetAll();
}
public Client GetById(int id)
{
var repository = new ClientRepository();
return repository.GetById(id);
}
public void PostSave(Client client)
{
var repository = new ClientRepository();
if (client.Id != 0)
{
repository.Update(client);
}
else
{
repository.Add(client);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment