diff --git a/docs/en/tutorials/modular-crm/images/abp-studio-browser-list-of-products.png b/docs/en/tutorials/modular-crm/images/abp-studio-browser-list-of-products.png new file mode 100644 index 0000000000..de4ea0bb26 Binary files /dev/null and b/docs/en/tutorials/modular-crm/images/abp-studio-browser-list-of-products.png differ diff --git a/docs/en/tutorials/modular-crm/images/abp-studio-build-and-restart-application.png b/docs/en/tutorials/modular-crm/images/abp-studio-build-and-restart-application.png new file mode 100644 index 0000000000..87c2d3c2b7 Binary files /dev/null and b/docs/en/tutorials/modular-crm/images/abp-studio-build-and-restart-application.png differ diff --git a/docs/en/tutorials/modular-crm/images/visual-studio-products-cshtml.png b/docs/en/tutorials/modular-crm/images/visual-studio-products-cshtml.png new file mode 100644 index 0000000000..c0b2721450 Binary files /dev/null and b/docs/en/tutorials/modular-crm/images/visual-studio-products-cshtml.png differ diff --git a/docs/en/tutorials/modular-crm/part-03.md b/docs/en/tutorials/modular-crm/part-03.md index beead283b8..c497217a23 100644 --- a/docs/en/tutorials/modular-crm/part-03.md +++ b/docs/en/tutorials/modular-crm/part-03.md @@ -425,6 +425,74 @@ We've some entities in the database, and we can show them on the user interface In this section, we will create a very simple user interface to demonstrate how to build UI in the products module and make it working in the main application. +As a first step, stop the application on ABP Studio's Solution Runner if it is currently running. + +Open the `ModularCrm.Products` .NET solution in your IDE, find the `Pages/Products/Index.cshtml` file under the `ModularCrm.Products.Web` project: + +![visual-studio-products-cshtml](images/visual-studio-products-cshtml.png) + +Replace the `IndexModel.cshtml.cs` file with the following content: + +````csharp +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace ModularCrm.Products.Web.Pages.Products; + +public class IndexModel : ProductsPageModel +{ + public List Products { get; set; } + + private readonly IProductAppService _productAppService; + + public IndexModel(IProductAppService productAppService) + { + _productAppService = productAppService; + } + + public async Task OnGetAsync() + { + Products = await _productAppService.GetListAsync(); + } +} +```` + +Here, we are simply using the `IProductAppService` to get a list of all products and assigning the result to the `Products` property. We can use it in the `Index.cshtml` file to show a simple list of products on the UI: + +````xml +@page +@using Microsoft.Extensions.Localization +@using ModularCrm.Products.Localization +@using ModularCrm.Products.Web.Pages.Products +@model ModularCrm.Products.Web.Pages.Products.IndexModel +@inject IStringLocalizer L + +

Products

+ + + + + @foreach (var product in Model.Products) + { + + @product.Name (stock: @product.StockCount) + + } + + + +```` + +You can build the product module's .NET solution (`ModularCrm.Products`), then right-click the `ModularCrm.Web` application on ABP Studio's solution runner and select the *Build & Restart* command: + +![abp-studio-build-and-restart-application](images/abp-studio-build-and-restart-application.png) + +Now, you can browse the *Products* page to see the list of the products: + +![abp-studio-browser-list-of-products](images/abp-studio-browser-list-of-products.png) + +As you see, it is pretty straightforward to develop a UI page in a modular ABP application. We kept the UI simple to focus on the modularity. If you want to learn how to build complex application UIs, please check the [Book Store Tutorial](../book-store/index.md). + TODO ## Notes