0
votes

We are currently working on .NET solution that contains a pure MVC project. At the beginning, it was fine. However, the content seems be be changed frequently.

I think it's better to make some blocks content and static pages into CMS. They can be list of posts for CMS blocks and CMS page for static page.

My team chooses Umbraco. The most difficulty is integrating the CMS system into the block.

I tried to follow this tutorial: https://24days.in/umbraco-cms/2016/adding-umbraco-to-existing-site/ . However, I got some issues like:

  1. I don't know how to rewrite route after moving the controller
  2. The system always tell me this error: System.Net.Http.Formatting -> I tried to install but it seems not an existing package.
  3. The tutorial is obsolete. The structure of the project seems to be changed.
  4. Source files gone.

I don't know if there's any recommendation and new tutorials for this situation. I might stuck in the installing of dependencies. Hope that I can get some advices from you guys so that I can continue.

2
Umbraco 8 is a few days old only. Most tutorials are for Umbraco 7. Take some time to learn how 8 works through its documentation (it's pretty good) and any questions you have afterwards, ask in our.umbraco.comJabberwocky

2 Answers

1
votes
  1. You don't pay to get a licence for Umbraco, it's Free open source software
  2. V8 was only released last week and a completely new version, a lot has been rewritten
  3. That article relates to V7 so you should expect that to work, not v8
  4. Good luck :-)
0
votes
  1. The tutorial is obsolete. The structure of the project seems to be changed.

Umbraco v8 is still pretty new, and as you said most of the documentation is obsolete. You can check the current state of the documentation here.

Other than that, you can download the source code from Git and check how things are done, but it can be really time consuming.

  1. I don't know how to rewrite route after moving the controller

If I understand right, you want to have your own controller, with your own route.

Umbraco has its own global.asax implementation and overwrites the default routings. The usual routing class is not executed, you have to add your routings when the application starts.

I managed to do that with creating a User Composer. User composers compose after core composers, and before the final composer. (Below, I create an IComposer, but IUserComposer should also work.)

public class ApplicationEventComposer : IComposer
{
    public void Compose(Composition composition)
    {
        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
}

In this one you can register your own RouteConfig, Bundles, etc. Just be careful, it is easy to mess up the Umbraco routings...

Here is an example to add a new controller called TestController:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.MapRoute(
            name: "Test",
            url: "Test/{action}/{id}",
            defaults: new { controller = "Test", action = "Index", id = UrlParameter.Optional }
        );
    }
}