Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Hartley 10 posts 31 karma points
    Apr 29, 2015 @ 02:00
    Neil Hartley
    0

    Mvc Architecture and umbraco Doc Type

    Hey guys,

    Just wondering if anyone might be able to offer some help on what I would imagine is something others have come across.

    I have an mvc site structure with a controller that has multiple action methods which have associated views. So for example.

    Controller - MyNews (inherits from RenderMvcController)
    ActionMethod - Index
    ActionMethod - Create

    The Mvc Url should be /MyNews/ and /MyNews/Create as they would be in MVC

    Ive created a single document type called MyNews and 2 templates, one for the index page and one for the create however the link to document for the create template is simple /create/ (without the /MyNews/ on the front)

    Am I donig something wrong as the way I understand umbraco route hijacking is that if I create a new doc type it will need a new controller which isnt what I want in terms of both the route and working with the controllers.

    I guess my question is can I have a single controller with multiple doc types?

    Thanks

  • Neil Hartley 10 posts 31 karma points
    Apr 29, 2015 @ 10:12
    Neil Hartley
    0

    Having slept on this im wondering if this is the only way to set up the doc type with multiple tempaltes. It could be an idea to write custom routes so the /MyNews/Create points to the correct controller and action method which would then return the umbraco view.

    This doesnt feel like the correct way of doing it though, feels more like a workaround..

  • Charles Afford 1163 posts 1709 karma points
    May 06, 2015 @ 22:58
    Charles Afford
    0

    Hi Neil, good to see you on our Umbraco :).

    What are you actually trying to achieve by doing this? What is the end goal? And i will try and help.

    Route hijacking is access a route that is the template/doctype name before the page is rendered :)

    Charlie

Please Sign in or register to post replies

Write your reply to:

Draft