I want to create WEB API which sends input to Angular. I want to send data in JSON format as an array.
Below is my code:
[HttpGet]
[ActionName("GetEmployeeByID")]
public Employee Get(int id)
{
Employee emp = null;
while (reader.Read())
{
emp = new Employee();
emp.ClientId = Convert.ToInt32(reader.GetValue(0));
emp.ClientName = reader.GetValue(1).ToString();
}
return emp;
}
Actual output:
{"ClientId":15,"ClientName":"Abhinav Singh"}
Expected output:
[{"ClientId":15,"ClientName":"Abhinav Singh"}]