Skip to content

Commit e023498

Browse files
authored
Merge pull request Azure#62 from ch-rob/crv-module2
Crv module2
2 parents ad4a9bb + 3c7e872 commit e023498

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

docs/aca/02-aca-comm/Create.cshtml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.AspNetCore.Mvc;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks.Models;
34

45
namespace TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks
56
{

docs/aca/02-aca-comm/Edit.cshtml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.AspNetCore.Mvc;
2-
using Microsoft.AspNetCore.Mvc.RazorPages;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks.Models;
34

45
namespace TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks
56
{

docs/aca/02-aca-comm/Index.cshtml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
namespace TasksTracker.WebPortal.Frontend.Ui.Pages
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks.Models;
4+
5+
namespace TasksTracker.WebPortal.Frontend.Ui.Pages
26
{
37
[IgnoreAntiforgeryToken(Order = 1001)]
48
public class IndexModel : PageModel

docs/aca/02-aca-comm/Tasks.Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNetCore.Mvc;
1+
using Microsoft.AspNetCore.Mvc;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
33

44
namespace TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks

docs/aca/02-aca-comm/TasksModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using Microsoft.AspNetCore.Mvc;
12
using System.ComponentModel.DataAnnotations;
23

4+
namespace TasksTracker.WebPortal.Frontend.Ui.Pages.Tasks.Models
5+
{
36
public class TaskModel
47
{
58
public Guid TaskId { get; set; }
@@ -43,4 +46,5 @@ public class TaskUpdateModel
4346
[Display(Name = "Assigned To")]
4447
[Required]
4548
public string TaskAssignedTo { get; set; } = string.Empty;
46-
}
49+
}
50+
}

docs/aca/02-aca-comm/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ canonical_url: https://bitoftech.net/2022/08/25/communication-microservices-azur
99
In this module, we will add a service named `ACA Web API – Frontend` as illustrated in the [architecture diagram](../../assets/images/00-workshop-intro/ACA-Architecture-workshop.jpg). This service will host a simple ASP.NET Razor pages web app which allows the end users to manage their tasks. After that we will provision Azure resources needed to deploy the service to ACA using Azure CLI.
1010
### 1. Create the Frontend Web App project (Web APP)
1111

12-
- Open a command-line terminal and navigate to root folder of your project. Create a new folder as shown below:
12+
- Open a command-line terminal and navigate to root folder of your project.
1313
```shell
14-
cd TasksTracker.ContainerApps
14+
cd ~\TasksTracker.ContainerApps
1515
```
1616

1717
- From VS Code Terminal tab, open developer command prompt or PowerShell terminal in the project folder `TasksTracker.ContainerApps` and initialize the project. This will create and ASP.NET Razor Pages web app project.
@@ -21,6 +21,7 @@ In this module, we will add a service named `ACA Web API – Frontend` as illust
2121
- We need to containerize this application, so we can push it to Azure Container Registry as a docker image then deploy it to ACA. Open the VS Code Command Palette (++ctrl+shift+p++) and select `Docker: Add Docker Files to Workspace...`
2222
2323
- Use `.NET: ASP.NET Core` when prompted for application platform.
24+
- Choose `TasksTracker.WebPortal.Frontend.Ui\TasksTracker.WebPortal.Fortend.Ui.csproj` when prompted to choose a project file.
2425
- Choose `Linux` when prompted to choose the operating system.
2526
- You will be asked if you want to add Docker Compose files. Select `No`.
2627
- Take a note of the provided **application port** as we will be using later on.
@@ -34,11 +35,11 @@ In this module, we will add a service named `ACA Web API – Frontend` as illust
3435
--8<-- "docs/aca/02-aca-comm/TasksModel.cs"
3536
```
3637
37-
- Now we will add 3 Razor pages for CRUD operations which will be responsible for listing all the tasks, creating a new task, and updating existing tasks.
38+
- Now, in the **Tasks** folder, we will add 3 Razor pages for CRUD operations which will be responsible for listing all the tasks, creating a new task, and updating existing tasks.
3839
By looking at the cshtml content notice that the page is expecting a query string named `createdBy` which will be used to group tasks for application users.
3940
4041
!!! note
41-
We are following this approach here to keep the workshop simple, but for production applications authentication should be applied and the user email should be retrieved from the claims identity of the authenticated users.
42+
We are following this approach here to keep the workshop simple, but for production applications, authentication should be applied and the user email should be retrieved from the claims identity of the authenticated users.
4243
4344
=== "Index.cshtml"
4445
@@ -86,7 +87,7 @@ By looking at the cshtml content notice that the page is expecting a query strin
8687
8788
=== "Program.cs"
8889
89-
```csharp hl_lines="12 13 14 15 16"
90+
```csharp hl_lines="12 13 14 15"
9091
namespace TasksTracker.WebPortal.Frontend.Ui
9192
{
9293
public class Program
@@ -101,7 +102,6 @@ By looking at the cshtml content notice that the page is expecting a query strin
101102
builder.Services.AddHttpClient("BackEndApiExternal", httpClient =>
102103
{
103104
httpClient.BaseAddress = new Uri(builder.Configuration.GetValue<string>("BackendApiConfig:BaseUrlExternalHttp"));
104-
105105
});
106106
107107
var app = builder.Build();
@@ -136,7 +136,7 @@ This variable will contain the Base URL for the backend API deployed in the prev
136136
- From VS Code Terminal tab, open developer command prompt or PowerShell terminal and navigate to the frontend directory which hosts the `.csproj` project folder and build the project.
137137
138138
```shell
139-
cd {YourLocalPath}\TasksTracker.WebPortal.Frontend.Ui
139+
cd ~\TasksTracker.ContainerApps\TasksTracker.WebPortal.Frontend.Ui
140140
dotnet build
141141
```
142142
!!! note
@@ -152,7 +152,7 @@ $FRONTEND_WEBAPP_NAME="tasksmanager-frontend-webapp"
152152
- Now we will build and push the Web App project docker image to ACR. Use the below command to initiate the image build and push process using ACR. The `.` at the end of the command represents the docker build context. In our case, we need to be on the parent directory which hosts the .csproject.
153153
154154
```powershell
155-
cd {YourLocalPath}\TasksTracker.ContainerApps
155+
cd ~\TasksTracker.ContainerApps
156156
az acr build --registry $ACR_NAME --image "tasksmanager/$FRONTEND_WEBAPP_NAME" --file 'TasksTracker.WebPortal.Frontend.Ui/Dockerfile' .
157157
```
158158
Once this step is completed you can verify the results by going to the Azure portal and checking that a new repository named `tasksmanager/tasksmanager-frontend-webapp` has been created and there is a new docker image with a `latest` tag is created.

0 commit comments

Comments
 (0)