
How it works...
Let's have a look at the completed steps. From steps 1 to 3, we opened an existing solution, which was completed in the previous recipe. Then we did a quick build for syntax checking. From steps 4 to 6, we have added an ASP.NET Web Application project to the existing solution. In step 7, we gave it a proper name.
Later on, in steps 8 and 9, we decided what sort of ASP.NET Web Application it should be. In this case, we have selected MVC empty template. In steps 13 to 15, we have added a Controller to the MVC application. We have selected an empty MVC 5 Controller.
In steps 19 to 21, we added the reference from the .NET Standard 2.0 library. In step 23, we referenced it at the code level. In step 24, in the first line of code, we created an instance of the TelephoneBook() class. In the second line, we invoked the GetContacts() method and stored it in ViewBag.Contacts. ViewBag is used to send data from the Controller to the View.
From steps 25 to 27, we added a View to the Controllers action method. In step 28, we changed existing code in the View template created for us by Visual Studio. Then, we looped through the contacts using Razor syntax. In steps 30 and 31, we tested the code in the browser.
From steps 31 to 50, we created views and tested other methods found in the TelephoneBook() class.