Spitting out a Index view using parameters

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2010-04-29T14:51:58Z Indexed on 2010/05/26 4:11 UTC
Read the original article Hit count: 417

Filed under:
|

Hello guys. I'm using ASP.MVC and trying to learn...

I have the following controller

    // get all authors
    public ActionResult Index()
    {
        var autores = autorRepository.FindAllAutores();

        return View("Index", autores);
    }

    // get authors by type
    public ActionResult Index(int id)
    {
        var autores = autorRepository.FindAllAutoresPorTipo(id);

        return View("Index", autores);
    }

If i try http://server/Autor/1 I get a 404 error. Why is that?

I even tried to create a specific method ListByType(int id) and the correspondent view, but that does not work too (URL: http://server/Autor/ListByType/1)

Any ideas? Thanks in advanced

EDIT Oh, the http://server/Autor works just fine. The method without parameters is spitting out my view correctly.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc