Surface Controller and UmbracoPage Controller
# help-with-umbraco
t
I have a list of customers and another page which is for a single customer. I would like to have content creators to create the customers with properties i have provided. The flow of the entire process is below 1. List of customers (Doc type and template created, no properties required) 2. Clicking a customer lands them to a new customer detail page (DT and template created with properties the content editors fill in). 3. On same page (public side), i have some fields which have been created using MVC Helpers (@Html.Label or controls). These are fields for users to add some notes/information about that customer. Once added they click a button to save that data to a custom table. 4. A new page will be created at this step (so not created yet) to summarise a list of all changes. A button to edit or proceed to next step would be available. 5. If proceeded, a thank you page is shown. 6. Finally this info is available to the backend team to action. I started with SurfaceController. I have a method called AddCustomer (Customer cust, string fieldOne, string fieldTwo) (step 3). I can see the values being populated in debug. I noted a new controller, UmbracoPageController which some recommended using this instead. I know SurfaceController is used to submit forms but not sure about UmbracoPageController as it too was doing very similar actions. I think this depends on how the pages are being created. For the above steps 4-6 i would like the new pages to be created in Umbraco and i add a partial view to carry out further programming (I think) which i think is correct for this scenario. Steps 1-6 need friendly URLs but also need a way to tie up the record/customer added so someone (backend user) can look at the data and authorise (I know this uses different Controller) but for this scenario and especially for friendly URLs is SurfaceController the correct approach here or should i swap it to UmbracoPageController - if so why? Thanks in advance
Would be amazing if anyone could give an indicators for the above or if they dont mind explaining the difference between UmbracoApiController, UmbracoPageController or RenderController and what purpose it serves then i might be able to figure this out. I did read the documentation but it doesnt really give me a good enough example to understand which i should use for different sceanrios
k
UmbracoApiController is an API Controller, used by backoffice or an integration or similar. It's not meant for browsing to. Typical use-case: return JSON for backoffice or update Umbraco via integration. RenderController is usually like a standard MVC Controller when browsing a page. Usually used as a base controller for certain document types. Typical use-case: Fetch some data and make it available in the Model for a View. SurfaceControllers take over the whole request, and you have to involve Umbraco manually. Typically meant for browsing to. Typical use case: Set a cookie and redirect to a page. Receive a form post and redirect back to the form page with a thank-you. Never heard of UmbracoPageController.
11 Views