Copied to clipboard

Flag this post as spam?

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


  • Brian Rush 25 posts 95 karma points
    Jun 01, 2017 @ 18:32
    Brian Rush
    0

    Best Practices / Pattern

    So I am new to Umbraco and I am trying to determine what the best practices or technique is to achieve something. Let me give you the scenario.

    I have one page that is an application page. Once a user submits and application an api request is made to submit the app and that returns with a code. The return code implies what message we give to the user.

    What I would like to do is redirect the user to that "Thank You" page with the code in the query string. The Thank You page for all the codes has a lot of similar content. However there is custom message also required for each code. What is the best way to render the custom content based on the querystring value for code? Partial Views?

    Thoughts? Any guidance / ideas is appreciated.

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jun 01, 2017 @ 21:52
    Alex Skrypnyk
    0

    Hi Brian

    I would start from pitfalls/antipatterns, look please here really cool doc- https://our.umbraco.org/documentation/reference/Common-Pitfalls/

    I prefer to write logic like you need in Controllers, do not write a lot of logic in partials. RenderMvcController looks like exactly what you need, it calls before view and you can do all logic here, read more - https://our.umbraco.org/documentation/reference/routing/custom-controllers

    Thanks,

    Alex

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 02, 2017 @ 08:51
    David Brendel
    0

    Hi Brian,

    if you need specific sentences for each return code that you use then it could be an option to add them as dictionary entries in Umbraco. The key would be the response code and then you can just grab the sentence by using the return code as the key in @Umbraco.GetDictionaryValue(returnCode)

    Regards David

Please Sign in or register to post replies

Write your reply to:

Draft