Skip to content

Commit

Permalink
Fixing documentation index
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienros committed Mar 21, 2019
1 parent 4a893d5 commit a90860a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 93 deletions.
26 changes: 14 additions & 12 deletions src/docs/guides/create-modular-application-mvc/index.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# Creating a modular ASP.NET Core MVC application
# Creating a modular ASP.NET Core application

## What you will build

You will build an application that is made of modules. The module will provide a Controller and a View while the Layout will
You will build an application that is made of modules. The module will provide a Controller and a View while the Layout will
be provided by the main application project.

## What you will need

- The current version of the .NET Core SDK. You can download it from here [https://www.microsoft.com/net/download/core](https://www.microsoft.com/net/download/core).

- A text editor and a terminal where you cant type dotnet commands.
- A text editor and a terminal where you can type dotnet commands.

## Creating an Orchard Core site and module

There are different ways to create sites and modules for Orchard Core. You can learn more about them [here](../../templates/README.md). In this guide we will use our "Code Generation Templates".
There are different ways to create sites and modules for Orchard Core. You can learn more about them [here](../../templates/README.md). In this guide we will use our "Code Generation Templates".

You can install the latest released templates using this command:

```dotnet new -i OrchardCore.ProjectTemplates::1.0.0-*```

> At the time of writing this Orchard Core is still in beta. This command install the latest available templates from nuget.org. You can also use the currently developped version of these templates by specifying `--nuget-source https://www.myget.org/F/orchardcore-preview/api/v3/index.json`
!!! note
To use the development branch of the template add `--nuget-source https://www.myget.org/F/orchardcore-preview/api/v3/index.json`

Create an empty folder that will contain your site. Open a terminal, navigate to that folder and run this:

Expand All @@ -33,15 +34,16 @@ We can now create a new module with the following command:
The module is created in the `MyModule` folder.
The next step is to reference the module from the application, by adding a project reference:

```dotnet add MySite/MySite.csproj reference MyModule/MyModule.csproj```
```dotnet add MySite reference MyModule```

## Testing the resulting application

From the root of the folder containing both projects, run this command:

```
dotnet run --project .\MySite\MySite.csproj
```
`dotnet run --project .\MySite\MySite.csproj`

!!! note
If you are using the development branch of the templates, run `dotnet restore https://www.myget.org/F/orchardcore-preview/api/v3/index.json` before running the application

Your application should now be running and contain the open ports:

Expand All @@ -51,14 +53,14 @@ Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
```

Open a browser on https://localhost:5001/MyModule/Home/Index
Open a browser on <https://localhost:5001/MyModule/Home/Index>
It should display __Hello from MyModule__

> The Layout is coming from the main application project, while the controller, action and view are coming from the module project.
## Registering a custom route

By default all routes in modules are modeled like `{area}/{controller}/action}` where `{area}` is the name of the module.
By default all routes in modules are modeled like `{area}/{controller}/{action}` where `{area}` is the name of the module.
We will change the route of the view in this module to handle the home page.

In the `Startup.cs` file of `MyModule`, add this code in the `Configure()` method.
Expand All @@ -72,7 +74,7 @@ In the `Startup.cs` file of `MyModule`, add this code in the `Configure()` metho
);
```

Restart the appliation and open the home page, which should display the same result as with the previous url.
Restart the application and open the home page, which should display the same result as with the previous url.

## Summary

Expand Down
81 changes: 0 additions & 81 deletions src/docs/guides/create-modular-application/index.md

This file was deleted.

0 comments on commit a90860a

Please sign in to comment.