Created
August 15, 2021 14:39
-
-
Save SibeeshVenu/bdbfdf46d94b59f919feb5e55dd5b75b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task MyAPIPut(HttpClient cons) | |
{ | |
using (cons) | |
{ | |
HttpResponseMessage res = await cons.GetAsync("api/tblTags/2"); | |
res.EnsureSuccessStatusCode(); | |
if (res.IsSuccessStatusCode) | |
{ | |
tblTag tag = await res.Content.ReadAsAsync<tblTag>(); | |
tag.tagName = "New Tag"; | |
res = await cons.PutAsJsonAsync("api/tblTags/2", tag); | |
Console.WriteLine("\n"); | |
Console.WriteLine("\n"); | |
Console.WriteLine("-----------------------------------------------------------"); | |
Console.WriteLine("------------------Calling Put Operation--------------------"); | |
Console.WriteLine("\n"); | |
Console.WriteLine("\n"); | |
Console.WriteLine("-----------------------------------------------------------"); | |
Console.WriteLine("tagId tagName tagDescription"); | |
Console.WriteLine("-----------------------------------------------------------"); | |
Console.WriteLine("{0}\t{1}\t\t{2}", tag.tagId, tag.tagName, tag.tagDescription); | |
Console.WriteLine("\n"); | |
Console.WriteLine("\n"); | |
Console.WriteLine("-----------------------------------------------------------"); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment