Vishal Maitry

Vishal Maitry

  • NA
  • 11
  • 13k

Unable to cast object of type 'System.Threading.Tasks.Task`1

Jan 24 2015 1:24 AM
public async Task<int> UpdateMediaAppCart(int cartId, int qty, decimal amount, DateTime updatedAt)
{
var client = new HttpClient();
var cartValue = new CartValues
{
CartId = cartId,
Quantity = qty,
Amount = amount,
UpdatedAt = updatedAt
};

var httpContent = new StringContent(JsonConvert.SerializeObject(cartValue), Encoding.UTF8, "application/json");
var result = await client.PutAsync(ConfigurationManager.AppSettings.Get("WebServiceUrl") + "/cart/update", httpContent);



return Convert.ToInt32(result.Content.ReadAsStringAsync());
}

Answers (1)