I want get signle text value from WEB API in xamarin
i was tried like below in xamaring forms, pls. help
public class ItemListClass
{
public string Item_Name { get; set; }
public string Price { get; set; }
public string Total { get; set; }
}
public async void saleItems_bind()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new
System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://xyz.in/api/SaleItems?invNo=1");
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
var ItemsS = JsonConvert.DeserializeObject<List<ItemListClass>>(content);
PItmeList.ItemsSource = ItemsS;
List<ItemListClass> tabiv = new List<ItemListClass>();
var details = from x in tabiv select new { name= x.Item_Name.FirstOrDefault(), pric = x.Price.FirstOrDefault() };
foreach (var k in details)
{
lbNam.Text = name.ToString();
lbPric.Text = pric.ToString();
}
}