using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using Newtonsoft.Json;
namespace FRPI.WebApi.Helper
{
public class DeserializeData
{
readonly string webUrl = "http://IpaddressOrDomainName/RootFolder/api/Controller/";
public List<OrderDetails> GetInvoiveNo(string invoiceno) {
string uri = webUrl + invoiceno;
using (HttpClient httpClient = new HttpClient()) {
Task<String> response = httpClient.GetStringAsync(uri);
return JsonConvert.DeserializeObjectAsync<List<OrderDetails>>(response.Result).Result;
}
}
}
}This code snippet shows how to call a web api inside the controller.
