Copied to clipboard

Flag this post as spam?

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


  • Mik 7 posts 79 karma points
    28 days ago
    Mik
    1

    Post requests to RenderMvcController?

    I have a custom routed RenderMvcController that lists out rows of a custom database table.

    If I want a form that creates a new record, it seems that because of how the RenderMvController is wired up to Umbraco.Web.Models.RenderModel which always wants an IPublishedContent instance, to use just a simple view model/DTO with validation attributes, etc seems complicated.

    The recommended approach instead seems to use a SurfaceController instead. So in essense I am splitting up GETs and POSTs between two controllers. (I know Surface controllers can render child actions too)

    Is this the correct way of doing this when using a custom controller, or am I missing something?

  • Alex 1 post 71 karma points
    28 days ago
    Alex
    0

    So in essense I am splitting up GETs and POSTs between two controllers.

    Yep! That's the idea. Split them into two separate controllers :)

  • Alex Skrypnyk 5176 posts 18866 karma points MVP 2x admin c-trib
    27 days ago
    Alex Skrypnyk
    0

    Hi Mik

    You are right, for handling POST and GET requests use SurfaceController, also there is UmbracoApiController btw.

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft