I have a table of employees that I am wanting to return all to the browser in XML. I have followed the tutorial here "http://csharp-video-tutorials.blogspot.com/2016/09/aspnet-web-api-and-sql-server.html" and did this in the same way. However, when I run this I do not get the list in XML at all.
I put this into the browser address bar: Employee/GetAll
{CONTROLLER CODE} // GET: ALL Employee public List<DimEmployee> GetAll() { using (AdventureWorks_MBDEV_DW2008Entities entities = new AdventureWorks_MBDEV_DW2008Entities()) { return entities.DimEmployees.ToList(); } }
I get this returned in the browser window instead of XML or JSON: System.Collections.Generic.List`1[AdventureWorksDataAccess.DimEmployee]
I have seen two tutorials where this returns XML but for some reason not for me. I am using MVC5 Web API; can anyone tell me why this isn't working?
Thanks.
No comments:
Post a Comment