title: Are the Drivers and Controllers in Orchard somewhat the same?
body: <p>I'm creating a new widget in the Orchard CMS. The way I do this is by adding a Route and Controller first and try out the functionality by running the code on an url defined in the Route, like <code>http://localhost:30320/Index</code>
  My Routes.cs is set up so it routes this request to the specified controller and stuff is happening on the screen. This all works quite well.</p>
  
  <p>Now that I'm happy with the result I tried placing all of this in a new Widget. For this I've created new Migrations class which sets up the widget. This is fairly straightforward and now the widget has been added to the Homepage layer.</p>
  
  <p>The thing I'm running into is the Controller isn't executed anymore. Not very strange as I haven't set up any routes which specify the Controller should be executed. I'm wondering, should I move the Controller logic to the Driver method, so the View still gets the necessary information?</p>
  
  <p>The driver I've got at the moment looks like this:</p>
  
  <pre><code>public class FrontpageDrivers : ContentPartDriver&lt;FrontpageModelPart&gt;
  {
      protected override DriverResult Display(FrontpageModelPart part, string displayType, dynamic shapeHelper)
      {
          //return base.Display(part, displayType, shapeHelper);
          if (displayType.StartsWith("Detail"))
              return ContentShape("Parts_Index", () =&gt; shapeHelper.Parts_Index(
                                                                      LatestPostCollection: part.LatestPostCollection,
                                                                      TopRatedPostCollection: part.TopRatedPostCollection,
                                                                      TotalMonthCollection: part.TotalMonthCollection,
                                                                      ContentPart: part
                                                                      ));
          return null;
      }
  }
  </code></pre>
  
  <p>The PartsController method which needs to be executed looks like this:</p>
  
  <pre><code>[HttpGet]
  public ActionResult Detail()
  {
      //Do something to get blogposts
      var getter = new GetBlogPost(_blogService, _blogPostService, _votingService);
      getter.Initialize();
  
      var latestPosts = getter.GetLatestPosts();
      var highestRankedPosts = getter.GetHighestRankedPosts();
      var archiveData = getter.GetTotalPostsPerMonth();
  
      var viewModel = new FrontpageModelPart();
      viewModel.LatestPostCollection = latestPosts;
      viewModel.TopRatedPostCollection = highestRankedPosts;
      viewModel.TotalMonthCollection = archiveData;
  
      return View("Index", viewModel);
  }
  </code></pre>
  
  <p>I've tried renaming the method to Index and Detail, both won't do the trick. 
  The view which is shown is <code>/Views/Parts/Index.cshtml</code>. If I put some static text in the file, I can see this view is being rendered correctly.</p>
  
  <p>So, should I move the Controller logic to the Driver, or am I forgetting something in the setup?</p>
  
  <p>Note: I've got the placement, module, migrations and handler in place already.</p>
  
  <p><strong>Edit</strong>:
  If I'm using this code, everything works quite well:</p>
  
  <pre><code>protected override DriverResult Display(FrontpageModelPart part, string displayType, dynamic shapeHelper)
  {
      var controller = new PartsController(Services, _blogService, _blogPostService, _votingService);
      part = controller.GetIndexViewModel();
  
      if (displayType.StartsWith("Detail"))
          return ContentShape("Parts_Index", () =&gt; shapeHelper.Parts_Index(
                                                                  LatestPostCollection: part.LatestPostCollection,
                                                                  TopRatedPostCollection: part.TopRatedPostCollection,
                                                                  TotalMonthCollection: part.TotalMonthCollection,
                                                                  ContentPart: part
                                                                  ));
      return null;
  }
  </code></pre>
  
  <p>Even though this works quite well, it just feels like 'hacking' to me...</p>