Estimated Time: 90 minutes
-
Start Visual Studio 2017.
-
In the Start Page - Microsoft Visual Studio window, on the FILE menu, point to New, and then click Project.
-
In the New Project dialog box, in the navigation pane, expand Installed, and then click Visual C#.
-
In the New Project dialog box, in the result pane, click ASP.NET Core Web Application.
-
In the Name box, type ActorsRazorPages.
-
Replace the content of the Location box with [Repository Root]\Allfiles\Mod01\Labfiles\01_ActorsRazorPages_begin, and then click OK.
-
In the result pane of the New ASP.NET Core Web Application - ActorsRazorPages dialog box, select ASP.NET Core 2.1 from the dropdown at the top of the dialog box.
-
In the result pane of the New ASP.NET Core Web Application - ActorsRazorPages dialog box, ensure that the Configure for HTTPS check box is not selected.
-
In the New ASP.NET Core Web Application - ActorsRazorPages dialog box, in the result pane, click Web Application, and then click OK.
-
In the ActorsRazorPages – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
-
In Microsoft Edge, in the address bar, note the port number that appears at the end of the URL http://localhost:[port]. You will use the port number during this lab.
-
In Microsoft Edge, in the navigation bar, click Contact to review its content.
-
In Microsoft Edge, click Close.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, expand Pages, and then click _ViewStart.cshtml.
-
In the _ViewStart.cshtml code window, note that the value of Layout is "_Layout".
Note: This indicates that all the files inside the Pages folder use the same layout file, ~/Pages/_Layout.cshtml.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under Pages, click Contact.cshtml.
-
In the Contact.cshtml code window, examine the Razor code, and verify that there are no links to .css files.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, expand Pages, expand Shared, and then click _Layout.cshtml.
-
In the _Layout.cshtml code window, in the HEAD element, note that there is a link to ~/css/site.css.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under ActorsRazorPages, expand wwwroot, expand css, and then click site.css
Note: This is the CSS stylesheet file that is applied in the _Layout.cshtml.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click Pages, point to Add, and then click New Item.
-
In the Add New Item – ActorsRazorPages dialog box, click Razor Page.
-
In the Add New Item – ActorsRazorPages dialog box, in the Name box, type TestPage, and then click Add.
-
In the ActorsRazorPages – Microsoft Visual Studio window, in the TestPage.cshtml code window, replace the content below @model line with the following code:
@{
ViewData["Title"] = "Test Page";
}
<h1>@ViewData["Title"]</h1>
<h2>This is a Test Page</h2>-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, expand Pages, expand Shared and then click _Layout.cshtml.
-
In the _Layout.cshtml code window, locate the following code:
<li><a asp-page="/Contact">Contact</a></li>- Place the cursor after the located code, press Enter, and then type the following code:
<li><a asp-page="/TestPage">Test Page</a></li>-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click ActorsRazorPages, point to Add, and then click New Folder.
-
In the NewFolder box, type Models, and then press Enter.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click Class.
-
In the Add New Item – ActorsRazorPages dialog box, in the Name box, type Actor, and then click Add.
-
In the Actor.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string KnownFor { get; set; }
public bool OscarWinner { get; set; }
public string ImageName { get; set; }-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click New Item.
-
In the Add New Item – ActorsRazorPages dialog box, click Interface.
-
In the Add New Item – ActorsRazorPages dialog box, in the Name box, type IData, and then click Add.
-
In the IData interface code block, place the cursor before the word interface, and then type public.
-
In the IData interface code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
List<Actor> ActorsList { get; set; }
List<Actor> ActorsInitializeData();
Actor GetActorById(int? id);-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then select Existing Item.
-
In the dialog box navigate to [Repository Root]\Allfiles\Mod01\Labfiles\01_ActorsRazorPages_begin, click Data.cs, and then click Add.
Note: Examine the Data.cs class content.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under wwwroot, right-click images, point to Add, and then click Existing Item.
-
In the dialog box, navigate to [Repository Root]\Allfiles\Mod01\Labfiles\01_ActorsRazorPages_begin\Images, select all the images, and then click Add.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, right-click Pages, point to Add, and then select New folder.
-
In the NewFolder box, type Actors, and then press Enter.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under Pages, right-click Actors, point to Add, and then click New Item.
-
In the Add New Item - ActorsRazorPages dialog box, click Web, and then, in the result pane, click Razor Page.
-
In the Add New Item – ActorsRazorPages dialog box, in the Name box, type Index, and then click Add.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, expand Index.cshtml, click Index.cshtml.cs, select the following code, and then press Delete.
public void OnGet()
{
}- In the Index.cshtml.cs code window, place the cursor at the end of the using Microsoft.AspNetCore.Mvc.RazorPages namespace code, press Enter, and then type the following code:
using ActorsRazorPages.Models;- In the Index.cshtml.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
private IData _data;
public IndexModel(IData data)
{
_data = data;
}
public IList<Actor> Actors { get; set; }
public void OnGet()
{
Actors = _data.ActorsInitializeData();
}-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under Pages, under Actors, click Index.cshtml.
-
In the ActorsRazorPages – Microsoft Visual Studio window, in the Index.cshtml code window, replace the content below @model line with the following code:
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Actors[0].FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.Actors[0].LastName)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Actors)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
<a asp-page="./Details" asp-route-id="@item.Id">Details</a>
</td>
</tr>
}
</tbody>
</table>-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, under Pages, right-click Actors, point to Add, and then click Existing Item.
-
In the dialog box, navigate to [Repository Root]\Allfiles\Mod01\Labfiles\01_ActorsRazorPages_begin\Pages, select Details.cshtml.cs and Details.cshtml, and then click Add.
Note: Examine the content of the Details.cshtml.cs and Details.cshtml files.
-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, click Startup.cs.
-
Ensure that the cursor is at the end of the using Microsoft.Extensions.DependencyInjection namespace code, press Enter, and then type the following code:
using ActorsRazorPages.Models;- Place the cursor after the { (opening braces) sign of the ConfigureServices method, press Enter, and then type the following code:
services.AddSingleton<IData, Data>();-
In the ActorsRazorPages - Microsoft Visual Studio window, in Solution Explorer, expand Pages, expand Shared, and then double-click _Layout.cshtml.
-
In the _Layout.cshtml code window, locate the following code:
<li><a asp-page="/TestPage">Test Page</a></li>- Place the cursor after the located code, press Enter, and then type the following code:
<li><a asp-page="/Actors/Index">Actors</a></li>-
In the ActorsRazorPages – Microsoft Visual Studio window, on the FILE menu, click Save All.
-
In the ActorsRazorPages – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
-
In Microsoft Edge, in the navigation bar, click Test Page to view its content.
Note: The browser window displays the title Test Page and the text "This is a Test Page".
-
In the Test Page window, in the navigation bar, click Actors to view its content.
Note: The browser window displays the Index.cshtml page under the Actors folder.
-
In the Actors window, select an actor, and then click Details to go to the Details page.
Note: The browser window displays the Details.cshtml page under the Actors folder.
-
Verify that the standard site layout and styles have been applied to all the pages.
-
In Microsoft Edge, click Close.
-
In the ActorsRazorPages - Microsoft Visual Studio window, on the FILE menu, click Exit.
Results: At the end of this exercise, you will be able to build a simple Razor Pages application in Visual Studio.
-
Start Visual Studio 2017.
-
In the Start Page - Microsoft Visual Studio window, on the FILE menu, point to New, and then click Project.
-
In the New Project dialog box, in the navigation pane, expand Installed, and then click Visual C#.
-
In the New Project dialog box, in the result pane, click ASP.NET Core Web Application.
-
In the Name box, type CakeStoreApi.
-
In the Location box, replace its content with [Repository Root]\Allfiles\Mod01\Labfiles\02_CakeStoreApi_begin, and then click OK.
-
In the result pane of the New ASP.NET Core Web Application - CakeStoreApi dialog box, ensure that the Configure for HTTPS check box is not selected.
-
In the New ASP.NET Core Web Application - CakeStoreApi dialog box, in the result pane, click API, and then click OK.
-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, expand Controllers, and then click ValuesController.cs.
Note: The Get() method returns value1 and value2.
-
In the CakeStoreApi – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
Note: The browser displays "["value1","value2"]".
-
In Microsoft Edge, click Close.
-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, right-click CakeStoreApi, point to Add, and then click New Folder.
-
In the NewFolder box, type Models, and then press Enter.
-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click Class.
-
In the Add New Item – CakeStoreApi dialog box, in the Name box, type CakeStore, and then click Add.
-
In the CakeStore.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
public int Id { get; set; }
public string CakeType { get; set; }
public int Quantity { get; set; }-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click New Item.
-
In the Add New Item - CakeStoreApi dialog box, click Interface.
-
In the Add New Item – CakeStoreApi dialog box, in the Name box, type IData, and then click Add.
-
In the IData.cs code block, place the cursor before the word interface, and then type public.
-
In the IData.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
List<CakeStore> CakesList { get; set; }
List<CakeStore> CakesInitializeData();
CakeStore GetCakeById(int? id);-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and select Existing Item.
-
In the dialog box, navigate to [Repository Root]\Allfiles\Mod01\Labfiles\02_CakeStoreApi_begin, click Data.cs, and then click Add.
Note: Examine the content in Data.cs.
-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, right-click Controllers, point to Add, and then click Controller.
-
In the Template list, click API Controller - Empty, and then click Add.
-
In the Add Empty API Controller dialog box, in the Controller name box, type CakeStoreApiController, and then click Add.
-
In the CakeStoreApiController.cs code block, ensure that the cursor is at the end of the using Microsoft.AspNetCore.Mvc namespace code, press Enter, and then type the following code:
using CakeStoreApi.Models;- In the CakeStoreApiController.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
private IData _data;
public CakeStoreApiController(IData data)
{
_data = data;
}
[HttpGet("/api/CakeStore")]
public ActionResult<List<CakeStore>> GetAll()
{
return _data.CakesInitializeData();
}
[HttpGet("/api/CakeStore/{id}", Name = "GetCake")]
public ActionResult<CakeStore> GetById(int? id)
{
var item = _data.GetCakeById(id);
if (item == null)
{
return NotFound();
}
return new ObjectResult(item);
}Note: The contents inside the HttpGet attributes indicate the URL that the user should write to get to the relevant action.
-
In the CakeStoreApi - Microsoft Visual Studio window, in Solution Explorer, click Startup.cs.
-
Ensure that the cursor is at the end of the using Microsoft.Extensions.Options namespace code, press Enter, and then type the following code:
using CakeStoreApi.Models;- Place the cursor after the { (opening braces) sign of the ConfigureServices method, press Enter, and then type the following code:
services.AddSingleton<IData, Data>();-
In the CakeStoreApi – Microsoft Visual Studio window, on the FILE menu, click Save All.
-
In the CakeStoreApi – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
-
In Microsoft Edge, in the address bar, type http://localhost:[port]/api/CakeStore, and then press Enter.
Note: The browser displays a list of cakes in JSON format.
-
In Microsoft Edge, in the address bar, type http://localhost:[port]/api/CakeStore/1, and then press Enter.
Note: The browser displays the first cake in the JSON format.
-
In Microsoft Edge, click Close.
-
In the CakeStoreApi - Microsoft Visual Studio window, on the FILE menu, click Exit.
Results: At the end of this exercise, you will be able to build a simple Web API application in Visual Studio.
-
Start Visual Studio 2017.
-
In the Start Page - Microsoft Visual Studio window, on the FILE menu, point to New, and then click Project.
-
In the New Project dialog box, in the navigation pane, expand Installed, and then click Visual C#.
-
In the New Project dialog box, in the result pane, click ASP.NET Core Web Application.
-
In the Name box, type AnimalsMvc.
-
In the Location box, replace the contents with [Repository Root]\Allfiles\Mod01\Labfiles\03_AnimalsMvc_begin, and then click OK.
-
In the result pane of the New ASP.NET Core Web Application - AnimalsMvc dialog box, ensure that the Configure for HTTPS check box is not selected.
-
In the New ASP.NET Core Web Application dialog box, in the result pane, click Web Application (Model-View-Controller), and then click OK.
-
In the AnimalsMvc – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
-
In Microsoft Edge, in the navigation bar, click Contact to review its content.
-
In Microsoft Edge, click Close.
-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, expand Views, and then click _ViewStart.cshtml.
-
In the _ViewStart.cshtml code window, note the value for Layout is "_Layout";.
-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, under Views, expand Home, and then click Contact.cshtml.
-
In the Contact.cshtml code window, note there are no files with the .css extension.
-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, under Views, collapse Home, expand Shared, and then click _Layout.cshtml.
-
In the _Layout.cshtml code window, note that in the HEAD element there is a link to ~/css/site.css.
-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, under AnimalsMvc, expand wwwroot, expand css, and then click site.css.
Note: This is the CSS stylesheet file that was applied in the _Layout.cshtml.
- In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, expand Controllers, click HomeController.cs, and then locate the following code:
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}- Place the cursor after the } (closing braces) sign of the located code, press Enter, and then type the following code:
public IActionResult TestPage()
{
return View();
}-
Right-click the code you just added, and then click Add View.
-
In the Add MVC View dialog box, ensure that the value in the View name box is TestPage.
-
In the Add MVC View dialog box, ensure that the Empty (without model) template is selected.
-
In the Add MVC View dialog box, ensure that the Create as a partial view check box is cleared and the Use a layout page check box is selected, and then click Add.
-
In the TestPage.cshtml code window, select the following code:
<h2>TestPage</h2>- Replace the selected code with the following code:
<h2>This is a Test Page</h2>-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, under Views, expand Shared, and then click _Layout.cshtml.
-
In the _Layout.cshtml code window, locate the following code:
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>- Place the cursor after the located code, press Enter, and then type the following code:
<li><a asp-area="" asp-controller="Home" asp-action="TestPage">Test Page</a></li>-
In the AnimalsMvc – Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click Class.
-
In the Add New Item – AnimalsMvc dialog box, in the Name box, type Animal, and then click Add.
-
In the Animal.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
public int Id { get; set; }
public string Name { get; set; }
public string ImageName { get; set; }
public string UniqueInformation { get; set; }
public string Category { get; set; }-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click New Item.
-
In the Add New Item - AnimalsMvc dialog box, click Interface.
-
In the Add New Item – AnimalsMvc dialog box, in the Name box, type IData, and then click Add.
-
In the IData interface code block, place the cursor before the word interface, and then write public.
-
In the IData interface code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
List<Animal> AnimalsList { get; set; }
List<Animal> AnimalsInitializeData();
Animal GetAnimalById(int? id);-
In the AnimalsMvc – Microsoft Visual Studio window, in Solution Explorer, right-click Models, point to Add, and then click Existing Item.
-
In the dialog box, navigate to [Repository Root]\Allfiles\Mod01\Labfiles\03_AnimalsMvc_begin, click Data.cs, and then click Add.
Note: Examine the contents of Data.cs .
-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, right-click on the Models, point to Add, and then click Class.
-
In the Add New Item – AnimalsMvc dialog box, in the Name box, type IndexViewModel, and then click Add.
-
In the IndexViewModel.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
public List<Animal> Animals { get; set; }-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, right-click Controllers, point to Add, and then click Controller.
-
In the Add Scaffold dialog box, click MVC Controller - Empty, and then click Add.
-
In the Add Empty MVC Controller dialog box, in the Controller name box, type AnimalsController, and then click Add.
-
In the AnimalsController.cs code window, ensure that the cursor is at the end of the using Microsoft.AspNetCore.Mvc namespace code, press Enter, and then type the following code:
using AnimalsMvc.Models;- In the AnimalsController.cs code window, select the following code, and then press Delete.
public IActionResult Index()
{
return View();
}- In the AnimalsController.cs code block, place the cursor after the second { (opening braces) sign, press Enter, and then type the following code:
private IData _tempData;
public AnimalsController(IData tempData)
{
_tempData = tempData;
}
public IActionResult Index()
{
List<Animal> animals = _tempData.AnimalsInitializeData();
IndexViewModel indexViewModel = new IndexViewModel();
indexViewModel.Animals = animals;
return View(indexViewModel);
}
public IActionResult Details(int? id)
{
var model = _tempData.GetAnimalById(id);
if (model == null)
{
return NotFound();
}
return View(model);
} -
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, expand wwwroot, right-click on the images, point to Add, and then click Existing Item.
-
In the dialog box, navigate to [Repository Root]\Allfiles\Mod01\Labfiles\03_AnimalsMvc_begin\Images, select all the images, and then click Add.
-
In the AnimalsController.cs code window, locate the following code, right-click the code, and then click Add View.
public IActionResult Index()-
In the Add MVC View dialog box, ensure that the value in the View name box is Index.
-
In the Add MVC View dialog box, ensure that the Empty (without model) template is selected.
-
In the Add MVC View dialog box, ensure that the Create as a partial view check box is cleared and the Use a layout page check box is selected, and then click Add.
-
In the Index.cshtml, erase all the content in the window, and type the following code:
@model AnimalsMvc.Models.IndexViewModel
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Animals[0].Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Animals[0].Category)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Animals)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category)
</td>
<td>
<a asp-action="Details" asp-route-id="@item.Id">Details</a>
</td>
</tr>
}
</tbody>
</table>-
In the AnimalsMvc - Microsoft Visual Studio window, in the Solution Explorer, under Controllers, click AnimalsController.cs.
-
In the AnimalsController.cs code window, locate the following code, right-click the code, and then click Add View.
public IActionResult Details(int? id)-
In the Add MVC View dialog box, ensure that the value in the View name box is Details.
-
In the Add MVC View dialog box, ensure that the Empty (without model) template is selected.
-
In the Add MVC View dialog box, ensure that the Create as a partial view check box is cleared and the Use a layout page check box is selected, and then click Add.
-
In Details.cshtml, erase all the contents in the window, and type the following code:
@model AnimalsMvc.Models.Animal
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>Animal</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Category)
</dt>
<dd>
@Html.DisplayFor(model => model.Category)
</dd>
<dt>
@Html.DisplayNameFor(model => model.UniqueInformation)
</dt>
<dd>
@Html.DisplayFor(model => model.UniqueInformation)
</dd>
</dl>
<div style="padding:10px;">
@if (Model.ImageName != "")
{
<img src="~/images/@Model.ImageName" alt="Sample Image" height="300" />
}
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, under Views, under Shared, click _Layout.cshtml.
-
In the _Layout.cshtml code window, locate the following code:
<li><a asp-area="" asp-controller="Home" asp-action="TestPage">Test Page</a></li>- Place the cursor after the located code, press Enter, and then type the following code:
<li><a asp-area="" asp-controller="Animals" asp-action="Index">Animals</a></li>-
In the AnimalsMvc - Microsoft Visual Studio window, in Solution Explorer, click Startup.cs.
-
Ensure that the cursor is at the end of the using Microsoft.Extensions.DependencyInjection namespace code, press Enter, and then type the following code:
using AnimalsMvc.Models;- Place the cursor after the { (opening braces) sign of the ConfigureServices method, press Enter, and then type the following code:
services.AddSingleton<IData, Data>();-
In the AnimalsMvc – Microsoft Visual Studio window, on the FILE menu, click Save All.
-
In the AnimalsMvc – Microsoft Visual Studio window, on the DEBUG menu, click Start Without Debugging.
-
In Microsoft Edge, in the navigation bar, click Test Page to review its content.
Note: The browser window displays the text "This is a Test Page".
-
In the Test Page window, in the navigation bar, click Animals to view its content.
Note: The browser window displays the Index.cshtml page, under the Animals folder.
-
In the Animals window, select an animal, and then click Details to go to the Details page.
Note: The browser window displays the Details.cshtml page, under the Animals folder.
-
Verify that the standard site layout and styles have been applied to all the pages.
-
In Microsoft Edge, click Close.
-
In the AnimalsMvc - Microsoft Visual Studio window, on the FILE menu, click Exit.
Results: At the end of this exercise, you will be able to build a simple MVC application in Visual Studio.
©2018 Microsoft Corporation. All rights reserved.
The text in this document is available under the Creative Commons Attribution 3.0 License, additional terms may apply. All other content contained in this document (including, without limitation, trademarks, logos, images, etc.) are not included within the Creative Commons license grant. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.
This document is provided "as-is." Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. Some examples are for illustration only and are fictitious. No real association is intended or inferred. Microsoft makes no warranties, express or implied, with respect to the information provided here.