Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implementing a POST method
// IRestClient.cs
[Post ("/posts")]
Task AddPost (Foo foo);
// RestClient.cs
public async Task AddPost (Foo foo)
{
await _restClient.AddPost (foo);
}
// Code-behind
private async void Handle_Clicked_Awesome_Post (object sender, System.EventArgs e)
{
var foo = new Foo {
id = 1337,
title = "Awesome!",
body = "Unicorns and rainbows",
userId = 1
};
await _restClient.AddPost (foo);
ResultLabel.Text = $"Added";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment