Question: 8 . Basic ASP.NET Core Application ( 1 3 Marks ) Scenario: Create a simple web application that displays a welcome message with the user's

8. Basic ASP.NET Core Application (13 Marks)
Scenario: Create a simple web application that displays a welcome message with the user's name.
6| Page
In line with industry requirements, CTU Training Solutions (PTY) Ltd is fully accredited by the MICT SETA (ACC/2006/07/186) through the Quality Council for Trades and Occupations
(QCTO). CTU Training Solutions is registered with the Department of Higher Education and Training as a Private College (2018/FE07/004) and provisionally registered as a private
higher education institution (only selected registered campuses)(No 2014/HE07/004). Directors: R Meeske, E Ferreira, B Brown | Co. Reg No:2005/038944/07
Components:
Controller: Handles user input and interacts with the view.
View: Displays the welcome message to the user.
Steps: (6)
Create a new ASP.NET Core Web Application project: Use Visual Studio or the dotnet new
webapp command. (2 marks)
Add a model class: Create a class named Person with properties for Name and optional Message.
(2 marks)
Create a controller: Add a controller named HomeController with an Index action method. (2
marks)
Implement the Index action method: (4)
Accept a parameter of type Person named person. (1 mark)
If person is null, create a new instance with an empty name. (1 mark)
Generate a welcome message using string interpolation: "Welcome, {person.Name}!".(1
mark)
Pass the person object and the welcome message to the view. (1 mark)
Create a view: Add a view named Index.cshtml in the Views/Home folder. (1 mark)
Implement the Index.cshtml view: (3)
Access the received person and message data. (1 mark)
Display the welcome message using an HTML heading element (e.g.,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!