Lab 05
Lab 05
M55340A | Module 5
M55340A | Module 5
Home
Lab Guide
Lab Guide
To construct the user interface of a city's web application, your development team
decided to add views. You have been asked to create the views to render a response to
a browser.
Exercise 1: Adding Views to an MVC Application
Scenario
To construct the user interface of a web application, views should be added to the web
application. In this exercise you will add two views to the web application: Index and
Details. The Index view will show a list of cities, and the Details view will show the
details of a city.
Note: The browser displays a Select City title and a list of cities below
it: Madrid, London, and Paris.
Note: The browser displays the city's name, details, mini map, and a Back link.
4. In Microsoft Edge, click Back.
5. In Microsoft Edge, click Close.
Result: At the end of this exercise, you have added views to an MVC application,
passed data from a controller to a view using ViewBag, and navigated between pages
by using helpers.
Exercise 2: Adding a Partial View
Scenario
You have been asked to display the population of each city. To do this, you have been
asked to add a partial view. In this exercise, you will create a partial view and embed it
in the ShowDataForCity view.
Note: The browser displays the city's name, details, mini map, population, and
a Back link.
4. In Microsoft Edge, click Close.
Result: At the end of this exercise, you will have used partial views, and used services
inside a view by using the @inject directive.
Exercise 3: Adding a View Component
Scenario
Currently, in the ShowCities view, for each city, you show a link with the name of the
city. You have been asked to show for each city in the ShowCities view, the country to
which the city belongs and a mini map of the city. To implement this you have been
asked to use a view component. In this exercise, you will create a view component and
embed it in the ShowCities view.
Note: The browser displays a list of cities. Each has a header link and mini map
image of the region.
3. In Microsoft Edge, click Madrid (Capital of Spain).
4. In Microsoft Edge, click Close.
5. In the CitiesWebsite -- Microsoft Visual Studio window, on the File menu,
click Exit.
Result: At the end of this exercise, you have created view components, and embeded
them in a view.
01:43:441 hour and 43 minutes remaining on your lab session
Keyboard released from VM