0

I have an asp.net core app which returns data in a c# data table object from an API function. The data returns is anonymous and cannot be parsed to a strongly typed ViewModel class. Please guide me how this data can be displayed in frontend using angular 4.

    [HttpPost, Route("display")]
    public IActionResult Display(int id)
    {
        DataTable datatable = Service.GetDataById(id);

        return Ok(datatable);
    }
  • Why is your GetDataById returning a DataTable anyway. Just make it return a list of a certain type and you are golden. – jpgrassi Jan 28 '18 at 12:56
  • @jpgrassi I cannot, the return type is not always same, hence the data table instead of c# class. – Application Manager Jan 28 '18 at 13:05
  • Don't return a DataTable. This mean that you are return all the properties and method of a DataTable (really it's not true, but it's almost you are telling to the program). Create an array of object and pass the values of the rows – Eliseo Jan 28 '18 at 13:24

0 Answers0