Hello World MVC

Use an MVC application as a CMS function on a page

Now you can use the Home controller from your MVC application on a page as a regular CMS function.

First of all, select where you want your MVC application to appear:

  1. Log into the CMS Console.
  2. From the Content perspective, select the page where you want to insert your MVC function.
  3. Click Edit Page on the toolbar. The page will open in Visual Editor.

Then, insert the MVC function (registered as “Test.SimpleMvc.Home” in this tutorial):

  1. On the page’s toolbar, click Insert, then Function.
  2. In the Select Function window, expand All Functions / Test / SimpleMvc and select the Home function.

    Figure 3: Selecting the regsitered Mvc function

  3. Click OK.

The function preview will appear on the edited page.

Figure 4: MVC function preview on an edited page

Finally:

  1. Save and publish the page.
  2. In Visual Studio, press F5 to launch the website in the browser and browse to the page. The page will show the contents of your simple MVC application.

Figure 5: The view of the MVC function on a published page