In Vb.Net
Public Function ReadAllData() As EmployeeEntityCollectionDim employee As EmployeeEntityCollection
Using client As New WebClient()
Dim _baseAddress As String = System.Configuration.ConfigurationManager.AppSettings("ClientbaseAddress")
client.Headers(HttpRequestHeader.Accept) = "application/json"client.BaseAddress = _baseAddress
Dim ApiUrl As String = "Employee/ReadAllData/?EmployeeId=" + String.Empty + "&EmployeeName=" + String.Empty
employee= JsonConvert.DeserializeObject(Of EmployeeEntityCollection)(client.DownloadString(ApiUrl))
Return employee
End Using
End Function
In C#.Net
public EmployeeEntityCollection ReadAllData()
{
EmployeeEntityCollection employee;
using (var client = new WebClient())
{
string _baseAddress=
System.Configuration.ConfigurationManager.AppSettings["ClientbaseAddress"];
client.Headers[HttpRequestHeader.Accept] = "application/json";
client.BaseAddress = _baseAddress;
string ApiUrl = "Employee/ReadAllData/?EmployeeId=" + string.Empty + "&EmployeeName=" + string.Empty;
employee = JsonConvert.DeserializeObject<EmployeeEntityCollection>(client.DownloadString(ApiUrl));
return employee
}
string _baseAddress=
System.Configuration.ConfigurationManager.AppSettings["ClientbaseAddress"];
client.Headers[HttpRequestHeader.Accept] = "application/json";
client.BaseAddress = _baseAddress;
string ApiUrl = "Employee/ReadAllData/?EmployeeId=" + string.Empty + "&EmployeeName=" + string.Empty;
employee = JsonConvert.DeserializeObject<EmployeeEntityCollection>(client.DownloadString(ApiUrl));
return employee
}
}
No comments:
Post a Comment