Skip to content

Instantly share code, notes, and snippets.

@SibeeshVenu
Created August 15, 2021 14:41
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 SibeeshVenu/b52bb82946ad305c5fa95bc1ccbe6ae8 to your computer and use it in GitHub Desktop.
Save SibeeshVenu/b52bb82946ad305c5fa95bc1ccbe6ae8 to your computer and use it in GitHub Desktop.
static async Task MyAPIPost(HttpClient cons)
{
using (cons)
{
var tag = new tblTag { tagName = "jQuery", tagDescription = "This tag is all about jQuery" };
HttpResponseMessage res = await cons.PostAsJsonAsync("api/tblTags", tag);
res.EnsureSuccessStatusCode();
if (res.IsSuccessStatusCode)
{
Console.WriteLine("\n");
Console.WriteLine("\n");
Console.WriteLine("-----------------------------------------------------------");
Console.WriteLine("------------------Calling Post Operation--------------------");
Console.WriteLine("------------------Created Successfully--------------------");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment