官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 辛集市| 五华县| 图们市| 开平市| 固安县| 芒康县| 云南省| 钦州市| 江都市| 榆中县| 团风县| 嘉定区| 周至县| 荆门市| 陈巴尔虎旗| 历史| 怀远县| 丰宁| 揭阳市| 珠海市| 墨竹工卡县| 桃源县| 贡山| 栖霞市| 永济市| 霍林郭勒市| 武胜县| 德格县| 巨鹿县| 塔河县| 邹城市| 盐亭县| 精河县| 股票| 波密县| 德兴市| 沈丘县| 凯里市| 合阳县| 合水县| 红桥区|