minor fixes in the partial code of update & delete definition (#3362)
* Update sample9.cs updated method definition Task<Product> as it should return product Task<Product> * Update sample10.cs Updating definition to return status code (Task<HttpStatusCode>)pull/3368/head
parent
184fe30215
commit
39939f6f27
|
@ -1,5 +1,5 @@
|
|||
static async Task DeleteProductAsync(string id)
|
||||
static async Task<HttpStatusCode> DeleteProductAsync(string id)
|
||||
{
|
||||
HttpResponseMessage response = await client.DeleteAsync($"api/products/{id}");
|
||||
return response.StatusCode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
static async Task UpdateProductAsync(Product product)
|
||||
static async Task<Product> UpdateProductAsync(Product product)
|
||||
{
|
||||
HttpResponseMessage response = await client.PutAsJsonAsync($"api/products/{product.Id}", product);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
@ -6,4 +6,4 @@ static async Task UpdateProductAsync(Product product)
|
|||
// Deserialize the updated product from the response body.
|
||||
product = await response.Content.ReadAsAsync<Product>();
|
||||
return product;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue