Webapi view content in a view

1

Hey guys, how are you?

I'm developing my first application on web api asp.net . And I'm having trouble displaying the content in a view .

Controller:

public class ListaPresenteController : ApiController
    {
        public IHttpActionResult Get()
        {
            var produto = new Produtos();
            return Ok(produto.Listar());
        }
    }

With this code it is working, but I was only able to display the list of products in home , I am having difficulty setting the view of products, and I want to display the list of products for example in url: www.meupai.com/produtos.

    
asked by anonymous 12.07.2014 / 18:51

1 answer

1

If your return has to be a view, I recommend that you use a controller, as in the example below. WebApi works as a WS, hence its return and a json or xml.

public class ListaPresenteController : Controller
{

}
    
14.07.2014 / 22:24