I want to make an endpoint that collects a some form data from the frontend. As I get it I should make a surface controller.
I am new to both C# MVC and Umbraco Surface Controllers. I usually place my C# code in the App_Data folder.
But is that the same place to put Surface Controllers? And how do I organize the different files? I am basically looking for a Hello World example and I can´t seem to find it with Google.
The simple answer is put your surface controller in the App_data folder and your partials and views in the Views folder.
The confusing thing in .NET is the mixture of compiled code and views (which are sort of still compiled but on use). Putting code into App_data means you avoid having to create dlls / build out solutions but it is just compiled when the app starts up instead.
You really need to be moving to using Visual Studio and compiling if things start getting complicated - if you're wondering how to organise your code in App_data you're probably ready! Plus the benefits of being able to debug and see what's happen make it worth the step. I'm sure Paul has a video for that in the early steps of his series.
I have marked Steves post as answer, not that DKMJ´s isn´t one too. But Steve was a direct answer to my question and DKMJ´s was broader and go for the day when I get the time to get to learn the stuff the really right way. :)
How to get started with surface controller?
Hi,
I want to make an endpoint that collects a some form data from the frontend. As I get it I should make a surface controller.
I am new to both C# MVC and Umbraco Surface Controllers. I usually place my C# code in the App_Data folder.
But is that the same place to put Surface Controllers? And how do I organize the different files? I am basically looking for a Hello World example and I can´t seem to find it with Google.
This doesn´t help me: https://our.umbraco.com/documentation/reference/routing/surface-controllers just
As always - Paul Seal is to the rescue.
He has an nice video and step by step guide. https://codeshare.co.uk/blog/how-to-create-a-contact-form-in-umbraco-using-mvc-and-c/
The simple answer is put your surface controller in the App_data folder and your partials and views in the Views folder.
The confusing thing in .NET is the mixture of compiled code and views (which are sort of still compiled but on use). Putting code into App_data means you avoid having to create dlls / build out solutions but it is just compiled when the app starts up instead.
You really need to be moving to using Visual Studio and compiling if things start getting complicated - if you're wondering how to organise your code in App_data you're probably ready! Plus the benefits of being able to debug and see what's happen make it worth the step. I'm sure Paul has a video for that in the early steps of his series.
HTH
Steve
Hey Martin
If you are new in c# mvc and umbraco you must read the following docs respectively.
Ref
1)
https://www.guru99.com/asp-net-mvc-tutorial.html
https://www.c-sharpcorner.com/UploadFile/cd3310/using-mvc-Asp-Net-tools-create-simple-login-form/
https://github.com/sarn1/example-aspnet-mvc
2)
https://our.umbraco.com/documentation/implementation/Controllers/
https://our.umbraco.com/documentation/reference/routing/surface-controllers
https://www.jondjones.com/learn-umbraco-cms/umbraco-7-tutorials/umbraco-and-mvc/what-is-an-umbraco-surface-controller/
Dhanesh:)
Thanks, Steve and DKMJ! :)
I have marked Steves post as answer, not that DKMJ´s isn´t one too. But Steve was a direct answer to my question and DKMJ´s was broader and go for the day when I get the time to get to learn the stuff the really right way. :)
is working on a reply...