I'm using .NET core 5. I don't know why I am getting this kind of result from my controllers:
[
{},
{},
{},
{},
{},
{},
{},
{}
]
Here's my controller code:
[HttpGet]
public async Task<IActionResult> SalesPerson()
{
var salesPersons = await GetAllSalesPersonsByWcf();
List<SalesPersonDto> salesPersonResult = salesPersons.Select(
x => new SalesPersonDto()
{
Id = x.Code,
Name = x.Name,
PhoneNo = x.Phone_No,
Type = x.SalesPerson_Type == 0 ? "visitor" : "disturbiutor"
}).ToList();
return Ok(salesPersonResult);
}
in debug mode, I have the value
But I don't know why I am getting that result.
Also, I have used and that solve the problem
Content(JsonConvert.SerializeObject(salesPersonResult), "application/json");
My question is why it's happening? and what did I do wrong?