diff --git a/docs/en/cli/index.md b/docs/en/cli/index.md index 3fd8eee2f4..334e17e0d1 100644 --- a/docs/en/cli/index.md +++ b/docs/en/cli/index.md @@ -70,6 +70,7 @@ Here, is the list of all available commands before explaining their details: * **`clear-download-cache`**: Clears the templates download cache. * **`check-extensions`**: Checks the latest version of the ABP CLI extensions. * **`install-old-cli`**: Installs old ABP CLI. +* **`generate-razor-page`**: Generate a page class and then use it in the ASP NET Core pipeline to return an HTML page. ### help @@ -964,6 +965,120 @@ Usage: abp install-old-cli [options] ``` +### generate-razor-page + +`generate-razor-page` command to generate a page class and then use it in the ASP NET Core pipeline to return an HTML page. + +Usage: + +1. Create a new `Razor Page(MyPage.cshtml)` that inherits from `AbpCompilationRazorPageBase` in `Views` folder. +2. Create a `MyPageModel` class in the same folder. +2. Create a `MyPage.js` and `MyPage.css` files in the same folder. +3. Add the following code to the `MyPage.cshtml`, `MyPage.css` and `MyPage.js` files. +4. Run the `generate-razor-page` command under the `Views` folder. + +```cs +public class MyPageModel +{ + public string Message { get; set; } + + public MyPageModel(string message) + { + Message = message; + } +} +``` + +```cs +@using System.Globalization +@using Volo.Abp.AspNetCore.MultiTenancy.Views +@using Volo.Abp.AspNetCore.RazorViews +@inherits AbpCompilationRazorPageBase +@{ + Response.ContentType = "text/html; charset=utf-8"; + Response.StatusCode = 200; +} + +@functions{ + public MyPage(MyPageModel model) + { + Model = model; + } + + public MyPageModel Model { get; set; } +} + + +
+ + +