{"id":1604,"date":"2025-01-16T06:40:08","date_gmt":"2025-01-16T11:40:08","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/nelson\/chapter\/chapter-15-more-on-an-example-website-with-a-database-connection\/"},"modified":"2025-02-06T06:49:02","modified_gmt":"2025-02-06T11:49:02","slug":"chapter14thirdedition-2","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/nelson\/chapter\/chapter14thirdedition-2\/","title":{"raw":"Chapter 15 More on an Example Website with a Database Connection","rendered":"Chapter 15 More on an Example Website with a Database Connection"},"content":{"raw":"<div class=\"chapter-15-more-on-an-example-website-with-a-database-connection\">\r\n<p class=\"import-Standard\">Original Material to the textbook: Fred Strickland<\/p>\r\n\r\n<h2>Learning Outcomes<\/h2>\r\n<table style=\"width: 467.5pt\">\r\n<tbody>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\"><strong>Computing Sub Discipline<\/strong><\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\"><strong>Document Code, Reference Code, and Page Number<\/strong><\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\"><strong>Text<\/strong><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;border-top: solid #00000A 0.5pt;border-right: solid #00000A 0.5pt;border-left: solid #00000A 0.5pt;padding: 0pt 5.4pt 0pt 5.65pt\" rowspan=\"5\">\r\n<p class=\"import-Standard\">Computer Science<\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">CS2013<\/p>\r\n<p class=\"import-Standard\">IM\/Query Languages<\/p>\r\n<p class=\"import-Standard\">(Page 1136)<\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">5. Embed object-oriented queries into a stand-alone language such as C++ or Java (e.g., SELECT Col.Method() FROM Object). [Usage]<\/p>\r\n<p class=\"import-Standard\">6. Write a stored procedure that deals with parameters and has some control flow, to provide a given functionality. [Usage]<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">CS2023<\/p>\r\n<p class=\"import-Standard\">DM-Core: Core Database Systems Concepts<\/p>\r\n<p class=\"import-Standard\">(Pages 115-116)<\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">CS Core 8. How to support CRUD-only applications<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">CS2023<\/p>\r\n<p class=\"import-Standard\">DM-NoSQL: NoSQL Systems<\/p>\r\n<p class=\"import-Standard\">(Pages 120-121)<\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">KA Core 1. Why NoSQL? (e.g., Impedance mismatch between Application [CRUD] and RDBMS)<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: 0.5pt solid #00000a\">CS2023\r\n\r\nFPL<a href=\"#_ftn1\">[1]<\/a>-Event-Driven:\u00a0 Event-Driven and Reactive Programming\r\n<p class=\"import-Standard\">(Pages 134-135)<\/p>\r\n\r\n<div>\r\n<div>\r\n\r\n<a href=\"#_ftnref1\">[1]<\/a> Foundations of Programming Languages (FPL)\u00a0 The ACM has added the Model View Controller as a learning outcome in the Software Engineering Design Software Design area.\u00a0 See page 243 in CS2023.\r\n\r\n<\/div>\r\n<\/div><\/td>\r\n<td style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: 0.5pt solid #00000a\">KA Core 6.\u00a0 Separation of model, view, and controller.\r\n<p class=\"import-Standard\">ILO KA Core 4.\u00a0 Describe an interactive system in terms of a model, a view, and a controller<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">CS2023<\/p>\r\n<p class=\"import-Standard\">SPD Web: Web Platforms<\/p>\r\n<p class=\"import-Standard\">(Page 302)<\/p>\r\n<\/td>\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">KA Core 1. Web programming languages (e.g., HTML5, JavaScript \u2026, CSS)<\/p>\r\n<p class=\"import-Standard\">KA Core 4. Web standards such as document object model, accessibility.<\/p>\r\n<p class=\"import-Standard\">Non-core 6. Analyzing requirements for web applications<\/p>\r\n<p class=\"import-Standard\">ILO KA Core 3. Compare and contrast web programming with general-purpose programming.<\/p>\r\n<p class=\"import-Standard\">ILO KA Core 5. Discuss how web standards impact software development.<\/p>\r\n<p class=\"import-Standard\"><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<td><\/td>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2>Introduction to Chapter 15<\/h2>\r\n<p class=\"import-Normal\">In Chapter 14, we looked at creating a front end that could interact with a database. The examples were based on Bootstrap 5. Since we did not add any JavaScript code, there was no functionality to the created web page. For this chapter, we have the same learning outcomes as for Chapter 14 plus the addition of CS2023 ILO KA Core 3.<\/p>\r\n<p class=\"import-Standard\">We will not repeat the paragraphs on website design. Nor will we repeat the paragraphs on how to design a good database. We will assume that we understand these concepts.<\/p>\r\n<p class=\"import-Standard\">We will be working with ASPNET Core, Entity Framework Core, Model-View-Controller framework, Bootstrap 5 with JavaScript, code-behind, and a SQL Server Management database.<\/p>\r\n\r\n<h2>The Third Edition Style Guide<\/h2>\r\n<p class=\"import-Standard\">This is the style guide that this book will follow for this chapter and for the other chapters.<\/p>\r\n\r\n<table style=\"width: 229.25pt\">\r\n<tbody>\r\n<tr class=\"TableNormal-R\">\r\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\r\n<p class=\"import-Standard\">Naming Convention:<\/p>\r\n\r\n<ul>\r\n \t<li>All English names<\/li>\r\n \t<li>Plural table names<\/li>\r\n \t<li>Singular column names<\/li>\r\n \t<li>Capitalized words<\/li>\r\n \t<li>Pascal Case for composite names<\/li>\r\n \t<li>No underscores or special characters<\/li>\r\n \t<li>No unique SQL commands<\/li>\r\n \t<li>No object prefixes<\/li>\r\n<\/ul>\r\n<p class=\"import-Standard\">Using the IE\u2019s Notation with Crow\u2019s Foot Notation.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Standard\">Figure 15.1 The database style guide. Adapted from https:\/\/vertabelo.com\/blog\/database-schema-naming-conventions\/<\/p>\r\n<p class=\"import-Standard\">The examples will conform to the style guide.<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Standard\"><span style=\"color: #ff0000\">The material in this chapter covers cutting edge technology. This area is changing rapidly. If you should decide to explore tutorials on the Internet, there are some cautions:<\/span><\/p>\r\n\r\n<ul>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid ASP.NET Core 6 and older. Microsoft made a major change. I used ASP.NET Core 8 for this chapter. ASP.NET Core 9 was out, but it is an 18-month edition.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid ADO.NET. This has been replaced by Entity Framework Core.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid very old editions of Visual Studio. As of this writing, 2022 is the most current edition.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid instructions on how to add Bootstrap to a Visual Studio project. Recent editions of Visual Studio include Bootstrap in the provided project templates.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid instructions pertaining to Microsoft.EntityFrameworkCore 6.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid any instructions that mention Start.cs. Program.cs is the correct file name.<\/span><\/li>\r\n \t<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid any instructions that mention JQuery and Bootstrap. JQuery was added in Bootstrap 3 and was dropped in Bootstrap 5.<\/span><\/li>\r\n<\/ul>\r\n<p class=\"import-Standard\"><span style=\"color: #ff0000\">This chapter may appear disjointed. I wanted to wrap up this project before the start of 2025.<\/span><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2>The Project: A Small Religious Educational Institution<\/h2>\r\n<h3>Storyboarding<\/h3>\r\n<p class=\"import-Normal\">We will storyboard the website and we will use the University of Notre Dame approach. Here is the first navigation row:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image1-11.png\" alt=\"image\" width=\"449.638950131234px\" height=\"129.611233595801px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.2 First navigation row.<\/p>\r\n<p class=\"import-Normal\">Here is the second navigation row:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image2-11.png\" alt=\"image\" width=\"460.839895013123px\" height=\"108.009343832021px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.3 Second navigation row.<\/p>\r\n<p class=\"import-Normal\">Under the \u201cAbout\u201d tab is information about the leadership, about the offices, about the history, about the mission, about notable alumni, about commitments, about financial information, and about a contact link. The middle has some text about the history of the university. On the far right is a quote. Scrolling down is information about the number of majors, colleges and schools, and the ranking based on several respectable authorities. There is more information.<\/p>\r\n<p class=\"import-Normal\">Under the \u201cVisit\u201d tab is information about the campus and the nearby area.<\/p>\r\n<p class=\"import-Normal\">In the second row is where one would find more detailed information. The \u201cAcademics\u201d tab has the academic units, the various academic programs, and other items. I did notice that a visitor would keep going deeper and deeper into the website. What I found troubling is the absence of a traditional catalog with academic plans and course descriptions.<\/p>\r\n<p class=\"import-Normal\">The \u201cAdmissions\u201d tab has a link to an application and another link to financial aid. It takes several mouse clicks to reach the actual form. And the actual application is hosted on three different third-party websites. A person must create an account before going forward. This has the benefit of saving the entries, but it has the disadvantage of preventing a person from previewing the questions.<\/p>\r\n<p class=\"import-Normal\">You may continue to explore the remaining tabs.<\/p>\r\n<p class=\"import-Normal\">As a personal note, I could not find on the University of Norte Dame website the traditional catalog. This is a large book that contains detailed information about the policies, about the programs, about the courses, about the faculty, and about other important items. I had the same issue with the Douglas College website. Has this document become obsolete? The answer is \u201cNo.\u201d Recall from Chapter 14 that Abhijeet Kaldate had a list of noteworthy higher education institutions. Let\u2019s look at Syracuse University in central New York.<\/p>\r\n<p class=\"import-Normal\">The Syracuse University navigation bar is simpler.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image3-13.png\" alt=\"image\" width=\"624px\" height=\"54.2666666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.4 The main Syracuse University navigation bar.<\/p>\r\n<p class=\"import-Normal\">Under the \u201cAcademics\u201d tab is the link to the catalog. The label is \u201cCourse Catalog.\u201d This label is a bit misleading since this contains more than just course information.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image4-12.png\" alt=\"image\" width=\"425.059317585302px\" height=\"806.112545931759px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.5 The Syracuse University academic drop down list.<\/p>\r\n<p class=\"import-Normal\">After some pondering, here is the new storyboard:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image5-13.png\" alt=\"image\" width=\"449.638950131234px\" height=\"50.4044094488189px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.6 Proposed Website (Unfortunately, the image is fuzzy.)<\/p>\r\n<p class=\"import-Normal\">The storyboard is very small. Here is an outline of the proposed website below the home page:<\/p>\r\n\r\n<ul>\r\n \t<li><strong>About<\/strong>\r\n<ul>\r\n \t<li>Leadership\r\n<ul>\r\n \t<li>Director<\/li>\r\n \t<li>Registrar and Financial Secretary<\/li>\r\n \t<li>Treasurer<\/li>\r\n \t<li>Assistant Treasurer<\/li>\r\n \t<li>Dean \u2013 Central Area<\/li>\r\n \t<li>Dean \u2013 Portland Area<\/li>\r\n \t<li>Dean \u2013 Aroostook County<\/li>\r\n \t<li>Dean \u2013 Bangor Area<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Offices\r\n<ul>\r\n \t<li>An A through Z list<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>History\r\n<ul>\r\n \t<li>When was the ABCOM Institute for Ministry founded?<\/li>\r\n \t<li>The first involved individuals.<\/li>\r\n \t<li>Sponsoring Organization: The American Baptist Churches of Maine<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Mission and Vision\r\n<ul>\r\n \t<li>Serving Leaders in Maine and Beyond<\/li>\r\n \t<li>The Mission is to provide ongoing theological, ministry, and discipleship education to pastoral leadership and laity in Maine.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Contact\r\n<ul>\r\n \t<li>Admissions Questions<\/li>\r\n \t<li>General Information Questions<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Academics<\/strong>\r\n<ul>\r\n \t<li>Programs\r\n<ul>\r\n \t<li>Basic Diploma Program<\/li>\r\n \t<li>Field Guidance Program<\/li>\r\n \t<li>Advanced Studies Program<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Libraries\r\n<ul>\r\n \t<li>Housed and Shared Locations<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Academic Calendar<\/li>\r\n \t<li>The Catalog\r\n<ul>\r\n \t<li>In PDF<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Admissions<\/strong>\r\n<ul>\r\n \t<li>Why ABCOM Institute for Ministry (AIM)?<\/li>\r\n \t<li>Application Process<\/li>\r\n \t<li>Financial Information\r\n<ul>\r\n \t<li>Annual Tuition and Fees<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Financial Aid<\/li>\r\n \t<li>Students Profile<\/li>\r\n \t<li>Request for Information<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Faith &amp; Service<\/strong>\r\n<ul>\r\n \t<li>Opportunities<\/li>\r\n \t<li>Employment<\/li>\r\n \t<li>Churches<\/li>\r\n \t<li>News<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Give<\/strong>\r\n<ul>\r\n \t<li>Why Give<\/li>\r\n \t<li>Ways to Give<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Alumni<\/strong>\r\n<ul>\r\n \t<li>Brian Casey<\/li>\r\n \t<li>John Cheney<\/li>\r\n \t<li><strong>Others<\/strong><\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<h3>The Home Page<\/h3>\r\n<p class=\"import-Normal\">This small religious educational institution does not perform cutting edge research nor has interesting news stories to share. We could have the following arrangement:<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Logo navigation<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Faith &amp; Service item<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Mission statement<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Calendar<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Footer<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Logo with social media links<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">More navigation buttons.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.7 Proposed Website home page<\/p>\r\n\r\n<h2>First Effort: Working with ASP.NET Core<\/h2>\r\n<p class=\"import-Normal\"><em>ASP.NET<\/em><em> Core<\/em> is an open source and cloud-optimized web framework. This is used for developing modern web applications that can run on Windows, on Linux, and on Mac. It includes the <em>M<\/em><em>odel-<\/em><em>V<\/em><em>iew-<\/em><em>C<\/em><em>ontroller (MVC) framework<\/em>, which is designed to separate the three parts of a program. The Entity Framework Core contains an Object-Relational Mapping (ORM) tool that works with data by using .NET objects.<\/p>\r\n<p class=\"import-Normal\">Check the edition of the .NET Core framework. On my older laptop, I had 7.0 and the support had ended in May 2024. If you have an older version, you could update or just do a removal-and-fresh-install. As of this writing, .NET 8.0 (Long Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote1anc\" href=\"#sdfootnote1sym\">1<\/a><\/sup> and .NET 9.0 (Standard Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote2anc\" href=\"#sdfootnote2sym\">2<\/a><\/sup>.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image6-12.png\" alt=\"image\" width=\"624px\" height=\"126.933333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.8 Screenshot of the .NET selection dropdown menu.<\/p>\r\n<p class=\"import-Normal\">Open Visual Studio<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote3anc\" href=\"#sdfootnote3sym\">3<\/a><\/sup> and select \u201cCreate a new project.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image7-14.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.9 The opening screen for Visual Studio 2022.<\/p>\r\n<p class=\"import-Normal\">In the Jan Potgieter article, the next step was to \u201cChoose ASP.Net Web Application (.Net Framework) template.\u201d In Visual Studio 2022, this entry does not exist. The closest entry is \u201cASP.Net Core Web App (Razor Pages)\u201d and \u201cASP.NET Core Web App (Model-View-Controller).\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image8-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.10 Visual Studio 2022 new project list (Filtered by the phrase of \u201cweb app.\u201d)<\/p>\r\n<p class=\"import-Normal\">Razor Pages technology makes coding page-focused scenarios easier and more productive than using controllers and views. Recall that the Model-View-Controller (MVC) is a framework that separates an application into three main logical components (the model, the view, and the controller). This is an approach that supports many developers working at the same time. This is known as \u201cseparation of concerns.<\/p>\r\n<p class=\"import-Normal\">With the \u201cseparation of concerns\u201d pattern, the user requests are routed to a <em>controlle<\/em>r that is responsible for working with the model. The <em>model <\/em>performs the user\u2019s requested action. This could be to retrieve the results from a query. The controller chooses the <em>view<\/em> for displaying the information back to the user. This approach means that the common actions can be used for routing to the user on a web page, to the user on a desktop application, or to the user on a kiosk in a shopping mall. The Figure 15.11 image is from the article entitled \"Overview of ASP.NET Core MVC\u201d and this illustrates these actions nicely.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image9-8.png\" alt=\"image\" width=\"327.2px\" height=\"313.6px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.11 Image of the MVC approach. Source of image: From the Internet<\/p>\r\n<p class=\"import-Normal\">Since MVC \u201cis one of the most frequently used industry-standard web development frameworks\u201d for creating scalable projects, we will use that approach. Choose the C# version.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image10-10.png\" alt=\"image\" width=\"624px\" height=\"143.866666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.12 Close up of the new \u201cASP.NET Core Web App (Model-View-Controller\u201d project menu item.<\/p>\r\n<p class=\"import-Normal\">Hit \u201cNext.\u201d On the \u201cConfigure your new project\u201d screen use the following entries:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Project name: ExampleWebApplication<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote4anc\" href=\"#sdfootnote4sym\">4<\/a><\/sup><\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Accepting the default entries.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image11-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.13 Configure the project screen.<\/p>\r\n<p class=\"import-Normal\">Although the Jan Potgieter article was published in 2022, she is using Visual Studio 2019 and Microsoft NET Framework Version 4.8.04084. Philip Gyllhamn wrote his article in 2019 and he is using Visual Studio 2019 and ASP.NET Core 2.1. He is creating an actual web page and so we will follow some of his steps.<\/p>\r\n<p class=\"import-Normal\">In the next screen, Select \u201c.NET 8. (Long Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote5anc\" href=\"#sdfootnote5sym\">5<\/a><\/sup>,\u201d no authentication type, configure for HTTPS. Then hit the create button.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image12-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.14 Additional information screen.<\/p>\r\n<p class=\"import-Normal\">Here is the working home screen for the project:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image13-10.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.15 The opening screen for the project.<\/p>\r\n\r\n<h3>Adding Bootstrap 5 to the Project<\/h3>\r\n<p class=\"import-Normal\">From Chapter 14, we learned that we can reference the Bootstrap library on another website by adding a line to the header block. There are other ways of adding Bootstrap support within Visual Studio:<\/p>\r\n\r\n<ul>\r\n \t<li>Enter the line manually into the text. (The approach was used by Jan Potgieter.)<\/li>\r\n \t<li>Add the Content Delivery Network (CDN) line to the project layout file (usually named as _Layout.cshtml).<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image14-9.png\" alt=\"image\" width=\"388.054173228346px\" height=\"528.073700787402px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.16 Screenshot of the Solution Explorer screen.<\/p>\r\n\r\n<ul>\r\n \t<li>Bootstrap support may be already present. See Figure 15.17.<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image15-10.png\" alt=\"image\" width=\"624px\" height=\"150.6px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.17 Screenshot of the top of the _Layout.cshtml file.<\/p>\r\n\r\n<ul>\r\n \t<li>Use the Node Package Manager (NPM) to import the actual Bootstrap files into the project.<\/li>\r\n \t<li>Use the NuGet package manager to import the actual Bootstrap files into the project.<\/li>\r\n \t<li>Use the LibMan<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote6anc\" href=\"#sdfootnote6sym\">6<\/a><\/sup>.<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\">When we selected the \u201ccreate HTTP option,\u201d Bootstrap support was added to the project. So we do not need to take any action about adding Bootstrap support.<\/p>\r\n<p class=\"import-Normal\">Figure 15.18 shows more of the _Layout.cshtml file.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image16-9.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.18 Screenshot of more lines of the _Layout.cshtml file.<\/p>\r\n\r\n<h3>Executing the MVC Program the First Time<\/h3>\r\n<p class=\"import-Normal\">To see what has been done for us, hit the run button. <img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image17-10.png\" alt=\"image\" width=\"78.0109186351706px\" height=\"27.0037795275591px\" \/><\/p>\r\n<p class=\"import-Normal\">If a floating dialog box appears, hit \u201cYes.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image18-8.png\" alt=\"image\" width=\"609px\" height=\"227px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.19 Screenshot of the floating dialog box on the SSL Certificate.<\/p>\r\n<p class=\"import-Normal\">Hit \u201cYes\u201d on the second floating dialog box.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image19-8.png\" alt=\"image\" width=\"512px\" height=\"475px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.20 Screenshot of the floating dialog box on a security warning.<\/p>\r\n<p class=\"import-Normal\">Hit \u201cYes\u201d on the third floating dialog box.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image20-8.png\" alt=\"image\" width=\"609px\" height=\"253px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.21 Screenshot of the floating dialog box about the IIS Express SSL certificate.<\/p>\r\n<p class=\"import-Normal\"><a id=\"_Hlk185746719\"><\/a>Hit \u201cYes.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image21-8.png\" alt=\"image\" width=\"552px\" height=\"528px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.22 Screenshot of the floating dialog box about the second security warning.<\/p>\r\n<p class=\"import-Normal\">Hit \u201cYes.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image22-8.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.23 Screenshot of the floating dialog box about the connection not being private.<\/p>\r\n<p class=\"import-Normal\">Hit \u201cAdvanced.\u201d Figure 15.24 shows the text from the \u201cAdvanced\u201d button.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image23-8.png\" alt=\"image\" width=\"624px\" height=\"291.133333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.24 Screenshot of the floating dialog box about the connection not being private.<\/p>\r\n<p class=\"import-Normal\">According to the article entitled \u201cGet started with ASP.NET Core MVC,\u201d this should have worked. For me, it did not<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote7anc\" href=\"#sdfootnote7sym\">7<\/a><\/sup>. A quick fix<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote8anc\" href=\"#sdfootnote8sym\">8<\/a><\/sup> is to use http instead of https:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image24-8.png\" alt=\"image\" width=\"108.015118110236px\" height=\"129.017952755906px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.25 Screenshot of the HTTP\/HTTPS options.<\/p>\r\n<p class=\"import-Normal\">Now hitting the run button will present the web page:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image25-8.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.26 Screenshot of the executing program.<\/p>\r\n<p class=\"import-Normal\">You must close the entire web browser session, not just the web page before you can do any further editing.<\/p>\r\n<p class=\"import-Normal\">We can begin to make some changes to this part of the program.<\/p>\r\n\r\n<h3>Which Bootstrap Version is Visual Studio Using?<\/h3>\r\n<p class=\"import-Normal\">When the web page is displayed, hit \u201cControl U\u201d on your keyboard. You will see the\u201d rel\u201d lines as hyper links.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image26-8.png\" alt=\"image\" width=\"624px\" height=\"146.8px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.27 Screenshot of the HTML header lines.<\/p>\r\n<p class=\"import-Normal\">Click on the line containing \u201cbootstrap.min.css.\u201d You will see the actual version number in the second line.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image27-7.png\" alt=\"image\" width=\"624px\" height=\"89px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.28 Screenshot of the bootstrap.min.css lines.<\/p>\r\n<p class=\"import-Normal\">Now, close the example web page. To obtain the latest version, do a right mouse click on the project name in the \u201cSolution Explorer\u201d box. Look for the \u201cAdd\u201d line. Follow this to the \u201cClient-Side Library.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image28-11.png\" alt=\"image\" width=\"624px\" height=\"493.666666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.29 Screenshot of the adding \u201cClient-Side Library.\u201d<\/p>\r\n<p class=\"import-Normal\">In the search box (the second box), type \u201cBootstrap.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image29-8.png\" alt=\"image\" width=\"624px\" height=\"437.266666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.30 Screenshot of the available bootstrap versions.<\/p>\r\n<p class=\"import-Normal\">It will display the current version available. In December 2024, it is 5.3.3. On the Bootstrap website, the last update was 5.3.3<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote9anc\" href=\"#sdfootnote9sym\">9<\/a><\/sup>. Since the default version is older, we will install the latest version. The Output box will show the steps. Notice that the Bootstrap files were installed on the hard drive.<\/p>\r\n\r\n<h3>Adding Bootstrap Lines to the _Layout.cshtml File<\/h3>\r\n<p class=\"import-Normal\">An integrated development environment (IDE) may use \u201ccode complete.\u201d For example, on the second line, starting typing \u201c&lt;!--.\u201d When you hit the space bar, the closing piece will appear. Be careful when you move your cursor around. If the ending piece does not have two hyphens, then the web page will not display.<\/p>\r\n<p class=\"import-Normal\">I began to edit the web page. As I did for Douglas College, I found the URL for the American Baptist Churches USA. For some strange reason, the image would not display. The alternate text would display. So I changed the URL for the American Baptist Churches of Maine logo that would display.<\/p>\r\n<p class=\"import-Normal\">Using the generated HTML code solved many issues. For example, the generated code has the top menu on every web page. Here is what I have so far:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image30-7.png\" alt=\"image\" width=\"624px\" height=\"682.2px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.31 Screenshot of the executing website.<\/p>\r\n\r\n<h3>More About the MVC Approach<\/h3>\r\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The model represents the data. It is here that we would validate the user\u2019s input and enforce any business rules<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote10anc\" href=\"#sdfootnote10sym\">10<\/a><\/sup>. We would use the model to work with a database.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image31-6.png\" alt=\"image\" width=\"275.03842519685px\" height=\"117.016377952756px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.32 Screenshot of the model tree.<\/p>\r\n\r\n<h3>More About the MVC View<\/h3>\r\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The view displays something to the user. So for this effort, it is a web page. Again, the user interface logic is stored in the view. The view does not handle business logic. Nor does the view interact with a database directly.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image32-7.png\" alt=\"image\" width=\"207.028871391076px\" height=\"103.0143832021px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.33 Screenshot of the view tree.<\/p>\r\n\r\n<h3>More About the MVC Controller<\/h3>\r\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The controller handles the web browser requests, retrieves the model\u2019s data, and calls upon the proper view template for displaying the information.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image33-6.png\" alt=\"image\" width=\"411.057322834646px\" height=\"193.026981627297px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.34 Screenshot of the controller tree.<\/p>\r\n\r\n<h3>Adding a Controller<\/h3>\r\n<p class=\"import-Normal\">There are two ways of adding a controller. One way is outside of the HomeController. The other way is to add to the HomeController. We see both approaches.<\/p>\r\n\r\n<h4>Adding a Controller Outside of the HomeController<\/h4>\r\n<p class=\"import-Normal\">In the Solution Explorer, do a right mouse click on \u201cController\u201d and select \u201cAdd Controller.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image34-6.png\" alt=\"image\" width=\"624px\" height=\"87.1333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.35 Screenshot of adding a controller outside of the HomeController.<\/p>\r\n<p class=\"import-Normal\">In the \u201cAdd New Scaffolded Item\u201d dialog box, select \u201cMVC Controller Empty Add.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image35-7.png\" alt=\"image\" width=\"624px\" height=\"431.133333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.36 Screenshot of adding a controller outside of the HomeController: Adding the scaffolding lines.<\/p>\r\n<p class=\"import-Normal\">Replace the default entry of \u201cHomeController1.cs\u201d with \u201cAbout.cs\u201d and hit the \u201cAdd\u201d button.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image36-4.png\" alt=\"image\" width=\"624px\" height=\"432.8px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.37 Screenshot of adding a controller outside of the HomeController: Selecting the desired web item.<\/p>\r\n<p class=\"import-Normal\">See Figure 15.38 for the result of this action:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image37-4.png\" alt=\"image\" width=\"624px\" height=\"121.266666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.38 Screenshot of the results of adding a controller outside of the HomeController.<\/p>\r\n<p class=\"import-Normal\">We can test out the C# code. Change the default text to look like Figure 15.39:<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">public class About : Controller<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">\/\/public IActionResult Index()<\/p>\r\n<p class=\"import-Normal\">\/\/ GET: \/About\/<\/p>\r\n<p class=\"import-Normal\">public string Index()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">\/\/ return View();<\/p>\r\n<p class=\"import-Normal\">return \"This is a test string from the About C# file.\";<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">\/\/<\/p>\r\n<p class=\"import-Normal\">\/\/ GET: \/About\/Welcome\/<\/p>\r\n<p class=\"import-Normal\">public string Welcome()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">return \"This is the Welcome action method...\";<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.39 C# code for the About Controller<\/p>\r\n<p class=\"import-Normal\">Execute the file. Do the following actions in order:<\/p>\r\n\r\n<ul>\r\n \t<li>After the port number, add \u201c\/About\u201d (Figure 15.40) to the end of the URL and hit the enter key.<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image38-5.png\" alt=\"image\" width=\"418.058372703412px\" height=\"125.017427821522px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.40 Screenshot of executing the About web page.<\/p>\r\n\r\n<ul>\r\n \t<li>After \u201c\/About,\u201d add \u201c\/Welcome\u201d and hit the enter key.<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image39-6.png\" alt=\"image\" width=\"437.060997375328px\" height=\"121.016902887139px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.41 Screenshot of executing the About\/Welcome web page.<\/p>\r\n\r\n<h4>Adding to the HomeController<\/h4>\r\n<p class=\"import-Normal\">This is the second approach. In the Solution Explorer, click on the \u201cHomeController.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image40-6.png\" alt=\"image\" width=\"404.056377952756px\" height=\"221.030866141732px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.42 Screenshot of the HomeController tree.<\/p>\r\n<p class=\"import-Normal\">Copy the IActionResult block from Figure15.43 and paste it in the order that you wish the item to appear in the menu. The Figure 15.43 shows the addition of \u201cAcademics\u201d and \u201cFaith &amp; Service:\u201d<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">public IActionResult Index()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">return View();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">public IActionResult Academics()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">return View();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">public IActionResult FaithAndService()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">return View();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">public IActionResult Privacy()<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">return View();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.43 The IActionResult blocks.<\/p>\r\n\r\n<h3>Adding a View<\/h3>\r\n<p class=\"import-Normal\">We want the view component to handle the display of our information. From Figure 15.6, we know that we need to add a view element for \u201cAbout,\u201d for \u201cAcademics,\u201d for \u201cAdmissions,\u201d for \u201cFaith &amp; Service,\u201d for \u201cGive,\u201d and for \u201cAlumni.\u201d There are two ways of adding a view. One way is outside of the Home folder. The other way is to add to the Home folder.<\/p>\r\n\r\n<h4>Adding a View Outside of the Home Folder<\/h4>\r\n<p class=\"import-Normal\">Right-click on the Views folder, and then <strong>Add <\/strong><strong>-<\/strong><strong>&gt; New Folder<\/strong> and name the folder \u201cAbout.\u201d See Figure 15.44.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image41-5.png\" alt=\"image\" width=\"624px\" height=\"468.933333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.44 The first step of adding a View.<\/p>\r\n<p class=\"import-Normal\">Right-click on the Views\/About folder, and then Add &gt; New Item. See Figure 15.45.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image42-5.png\" alt=\"image\" width=\"624px\" height=\"475.666666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.45 The second step of adding a View.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image43-2.png\" alt=\"image\" width=\"624px\" height=\"433px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.46 The result of the second step of adding a View.<\/p>\r\n<p class=\"import-Normal\">Select the \u201cRazor View \u2013 Empty.\u201d Notice that the \u201cName\u201d field changes to read \u201cIndex.cshtml.\u201d See Figure 15.47.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image44-2.png\" alt=\"image\" width=\"624px\" height=\"433px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.47 The result of selecting \u201cRazor View \u2013 Empty\u201d in the second step of adding a View.<\/p>\r\n<p class=\"import-Normal\">Hit the \u201cAdd\u201d button. The dialog box goes away and a empty file appears. See Figure 15.48.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image45-2.png\" alt=\"image\" width=\"624px\" height=\"93.4px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.48 The empty \u201cIndex.cshtml\u201d file.<\/p>\r\n<p class=\"import-Normal\">Replace canned lines with the following:<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">@{<\/p>\r\n<p class=\"import-Normal\">ViewData[\"Title\"] = \"Index\";<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">&lt;h2&gt;Index About&lt;\/h2&gt;<\/p>\r\n<p class=\"import-Normal\">&lt;p&gt;Hello from our About View Template!&lt;\/p&gt;<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.49 The replacement lines in the \u201cIndex.cshtml\u201d file.<\/p>\r\n<p class=\"import-Normal\">Edit the Controller file to read:<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">namespace ABCOMIMWebApplication.Controllers<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">public class About : Controller<\/p>\r\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">{<\/p>\r\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">public IActionResult Index()<\/p>\r\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">{<\/p>\r\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">return View();<\/p>\r\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">}<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.50 The revised lines in the About Controller file.<\/p>\r\n<p class=\"import-Normal\">Now execute the web page with About in the address bar:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image46-2.png\" alt=\"image\" width=\"624px\" height=\"685px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.51 The result of executing the revised About web page.<\/p>\r\n\r\n<h4>Adding a View Inside the Home Folder<\/h4>\r\n<p class=\"import-Normal\">Right-click on the Home folder inside the Views folder, and then Add &gt; New Item. Name it \u201cAcademics.\u201d<\/p>\r\n<p class=\"import-Normal\">In the search box in the upper-right, enter view.<\/p>\r\n<p class=\"import-Normal\">Select Razor View \u2013 Empty.<\/p>\r\n<p class=\"import-Normal\">Replace the canned lines with the following:<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">@{<\/p>\r\n<p class=\"import-Normal\">ViewData[\"Title\"] = \"Academics\";<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">&lt;h1&gt;@ViewData[\"Title\"]&lt;\/h1&gt;<\/p>\r\n<p class=\"import-Normal\">&lt;p&gt;Use this page to detail the academics.&lt;\/p&gt;<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.52 The revised lines for adding the \u201cAcademics\u201d view to the Home Folder<\/p>\r\n<p class=\"import-Normal\">These steps could be repeated for other views. See Figure 15.53 for \u201cAcademics\u201d and for \u201cFaithAndService.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image47-2.png\" alt=\"image\" width=\"184.816062992126px\" height=\"156.013543307087px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.53 Showing views outside of the \u201cHome\u201d folder and inside the \u201cHome\u201d folder.<\/p>\r\n\r\n<h3>Adding a Model<\/h3>\r\n<p class=\"import-Normal\">Recall that the model does the actual interfacing with a database. We will create classes for working with a database. The Rick Anderson and Jon P. Smith article is about creating a movies database from the website side. That may not be the case when a database exists already. Rick Anderson and Jon P. Smith do not mention in their article that there is a weakness with their approach. The weakness is that any database created through this avenue may not be well defined. All the needed tables and fields may not be created and normalization issues may be present.<\/p>\r\n<p class=\"import-Normal\">For the small religious educational institution, I am working with the following tables:<\/p>\r\n\r\n<ul>\r\n \t<li>Persons (These are the common elements for anyone associated with American Baptist Churches of Maine Institute of Ministry (ABCOMIM). I do not have a position or role in this table, because a person could be filling more than one role. I am not storing the date of birth, the gender, and the government ID number. I do not perceive these items as being necessary. Website visitors will not have access to the entire table. We will pull from this table and from another table for populating the \u201cLeadership\u201d web page.\r\n<ul>\r\n \t<li>ID Number (Generated by the database table.)<\/li>\r\n \t<li>Title (Mr., Mrs., Ms., Dr., and so on)<\/li>\r\n \t<li>First Name<\/li>\r\n \t<li>Middle Name<\/li>\r\n \t<li>Last Name<\/li>\r\n \t<li>Maiden Name<\/li>\r\n \t<li>Preferred Name<\/li>\r\n \t<li>Suffix<\/li>\r\n \t<li>Home Church (Use an ID here and reference another table.)<\/li>\r\n \t<li>Education (This is not stored in this table. We reference another table, because a person could have more than one degree.)<\/li>\r\n \t<li>Next of Kin (Use an ID here and reference this table.)<\/li>\r\n \t<li>Active (Yes or No. This avoids the need for an archive table.)<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Telephone Numbers (We do not have the telephone number item with the Persons table, because a person could have more than one telephone number. We are assuming that a person has only one cell phone number, only one home telephone number, and only one office telephone number.)<\/li>\r\n<\/ul>\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\" style=\"margin-left: 30.6pt\">Values for the Columns<\/p>\r\n<\/td>\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">Examples<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<ul>\r\n \t<li>PersonID<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote11anc\" href=\"#sdfootnote11sym\">11<\/a><\/sup><\/li>\r\n \t<li>1. Cell<\/li>\r\n \t<li>2. Home<\/li>\r\n \t<li>3. Office<\/li>\r\n \t<li>4. Other<\/li>\r\n \t<li>1. Actual cell phone number<\/li>\r\n \t<li>2. Actual home phone number<\/li>\r\n \t<li>3. Actual office phone number<\/li>\r\n \t<li>4. Actual other phone number.<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\"><\/p>\r\n<\/td>\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">1 1 0000000000<\/p>\r\n<p class=\"import-Normal\">1 2 0000000001<\/p>\r\n<p class=\"import-Normal\">1 3 0000000002<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\" style=\"margin-left: 18pt\">Figure 15.54 More details on the example phone table with example entries.<\/p>\r\n\r\n<ul>\r\n \t<li>E-Mail Addresses (We do not have the e-mail address item in the Persons table, because a person could have more than one e-mail address. The coding and the columns are similar to the Telephone table.)<\/li>\r\n \t<li>PersonID\r\n<ul>\r\n \t<li>1. Personal<\/li>\r\n \t<li>2. Office<\/li>\r\n \t<li>3. Other<\/li>\r\n \t<li>1. Actual personal e-mail address<\/li>\r\n \t<li>2. Actual office e-mail address<\/li>\r\n \t<li>3. Actual other e-mail address<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Addresses (We do not have the address item with the Persons table, because a person could have more than one address. The coding and the columns are similar to the Telephone table.)\r\n<ul>\r\n \t<li>PersonID<\/li>\r\n \t<li>1. Current or home<\/li>\r\n \t<li>2. Permanent<\/li>\r\n \t<li>3. Office<\/li>\r\n \t<li>4. Temporary or Vacation or Other<\/li>\r\n \t<li>1. Actual Current or Home address.<\/li>\r\n \t<li>2. Actual Permanent address<\/li>\r\n \t<li>3. Actual Office address<\/li>\r\n \t<li>4. Actual Temporary or Vacation or Other<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Students (Using the Person ID number, we can pull up the common elements from the Persons table. Using this ID and the program ID in the academic progress table, we can view what courses the student has taken.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>Program ID<\/li>\r\n \t<li>First enrollment date<\/li>\r\n \t<li>Holds (Yes or No; If \u201cYes,\u201d then the hold table would be used, because a student could have more than one hold active.)<\/li>\r\n \t<li>Advisor ID<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Holds (The student ID could be repeated if the student has more than one type of hold.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>(financial, academic, etc.)\r\n<ul>\r\n \t<li>1 for academic<\/li>\r\n \t<li>2 for financial<\/li>\r\n \t<li>3 for moral<\/li>\r\n \t<li>4 for whatever<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Instructors (We will track what courses this person has taught in the Schedules table.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>Subject area<\/li>\r\n \t<li>Availability<\/li>\r\n \t<li>Salary<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Leaders (This table with the Persons table would be used to populate the leadership web page. A person could be doing two or more leadership roles. More roles could be added in the future. The deans could be more administrative and advisors could be more academic. Since this is a small institute, the deans could be doing both.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>Position\r\n<ul>\r\n \t<li>1. Director<\/li>\r\n \t<li>2. Assistant Director<\/li>\r\n \t<li>3. Dean Central<\/li>\r\n \t<li>4. Dean Eastern<\/li>\r\n \t<li>5. Dean Northern<\/li>\r\n \t<li>6. Dean Southern<\/li>\r\n \t<li>7. Advisor<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Invoices (From the viewpoint of a student.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>Invoice ID<\/li>\r\n \t<li>Purpose\r\n<ul>\r\n \t<li>1. Course fees<\/li>\r\n \t<li>2. Lab fees<\/li>\r\n \t<li>3. Registration<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Amount<\/li>\r\n \t<li>Due date<\/li>\r\n \t<li>Payment Status\r\n<ul>\r\n \t<li>1. Paid in full<\/li>\r\n \t<li>2. Partial payment<\/li>\r\n \t<li>3. Overdue<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Balance<\/li>\r\n \t<li>Last Status date<\/li>\r\n \t<li>Payment method\r\n<ul>\r\n \t<li>1. Cash<\/li>\r\n \t<li>2. Check<\/li>\r\n \t<li>3. Donation<\/li>\r\n \t<li>4. Scholarship<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Offered Programs\r\n<ul>\r\n \t<li>ID for each unique offering\r\n<ul>\r\n \t<li>1 Basic Diploma<\/li>\r\n \t<li>2 Advanced Diploma<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Program Requirements (This would be a combination of IDs. The first ID is for the program and the second ID is for the course. A third column could be used to reflect when the program requirements were approved. This would handle the situation if a program offering is changed. There would be students on the old program requirements. The student enrollment date would be used to determine which version the student could be using.)\r\n<ul>\r\n \t<li>Program ID<\/li>\r\n \t<li>Course ID or course code.<\/li>\r\n \t<li>Program approval date<\/li>\r\n \t<li>Courses\r\n<ul>\r\n \t<li>Course code (for example: NT1, NT2, BHP, etc.)<\/li>\r\n \t<li>Course description<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Schedule (This gives us the ability to schedule a course for a future term and to look at the history of a course. We would also be able to determine which courses were canceled.)\r\n<ul>\r\n \t<li>Schedule ID<\/li>\r\n \t<li>Semester (I am assuming this is on a semester scheme instead of a quarter scheme.)\r\n<ul>\r\n \t<li>1. Fall<\/li>\r\n \t<li>2. Spring<\/li>\r\n \t<li>3. Summer<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Year (In four digits. Avoids issues in 2100.)<\/li>\r\n \t<li>Course Code<\/li>\r\n \t<li>Section Number (If two sessions are never offered in a term for a course, then this field could be dropped.)<\/li>\r\n \t<li>Meeting Format\r\n<ul>\r\n \t<li>1. In person<\/li>\r\n \t<li>2. Hybrid<\/li>\r\n \t<li>3. Virtual<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Meeting Location (N\/A or an actual location.)<\/li>\r\n \t<li>Meeting Days\r\n<ul>\r\n \t<li>1. Sunday only<\/li>\r\n \t<li>2. Monday only<\/li>\r\n \t<li>3. Tuesday only<\/li>\r\n \t<li>4. Wednesday only<\/li>\r\n \t<li>5. Thursday only<\/li>\r\n \t<li>6. Friday only<\/li>\r\n \t<li>7. Saturday only<\/li>\r\n \t<li>8. Monday and Wednesday<\/li>\r\n \t<li>9. Tuesday and Thursday<\/li>\r\n \t<li>10. To be determined<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Meeting Times (This is the start time expressed in a 24-hour clock.<\/li>\r\n \t<li>Duration<\/li>\r\n \t<li>Instructor ID<\/li>\r\n \t<li>Status (Active or Cancelled. With this field, we know whether or not the course ran.)<\/li>\r\n \t<li>Do we need to have the actual calendar dates?<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Enrollment\r\n<ul>\r\n \t<li>Student ID<\/li>\r\n \t<li>Schedule ID (We know when the student was enrolled in a term. This can track when a student has repeated a course.)<\/li>\r\n \t<li>Course Code (We know which courses the student took.)<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Academic progress (Using the three IDs, we can create an unofficial transcript. For the official transcript, we can add a business rule to keep only the highest grade and ignore a duplicate course with a low grade.)\r\n<ul>\r\n \t<li>Student ID<\/li>\r\n \t<li>Program ID<\/li>\r\n \t<li>Schedule ID<\/li>\r\n \t<li>Course Code<\/li>\r\n \t<li>Status (We can pull up the student\u2019s program and see what has been completed<\/li>\r\n \t<li>Completed or Needed or must repeat)<\/li>\r\n \t<li>Grade<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Scholarship\r\n<ul>\r\n \t<li>ID Number<\/li>\r\n \t<li>Name of Scholarship<\/li>\r\n \t<li>Amount<\/li>\r\n \t<li>Deadline Date<\/li>\r\n \t<li>Requirements<\/li>\r\n \t<li>Point of Contact ID<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>AwardedScholarship\r\n<ul>\r\n \t<li>\u201cStudent\u201d ID<\/li>\r\n \t<li>Scholarship ID<\/li>\r\n \t<li>Amount<\/li>\r\n \t<li>Other details<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Churches (This table will persist even if there is no one in the person table with a relationship to a table.)\r\n<ul>\r\n \t<li>ID<\/li>\r\n \t<li>Name<\/li>\r\n \t<li>Shorten Name<\/li>\r\n \t<li>Address<\/li>\r\n \t<li>URL<\/li>\r\n \t<li>Pastor ID (this points back to the persons table.)\r\n<ul>\r\n \t<li>Note: The telephone number would be based on the person\u2019s office telephone number.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Education (We can document more than one type.)\r\n<ul>\r\n \t<li>Person ID<\/li>\r\n \t<li>1 No award<\/li>\r\n \t<li>2 High school or GED<\/li>\r\n \t<li>3 Associate\u2019s degree<\/li>\r\n \t<li>4 Bachelor\u2019s degree<\/li>\r\n \t<li>5 Master\u2019s degree<\/li>\r\n \t<li>6 Doctoral or Ph.D. or terminal degree<\/li>\r\n \t<li>7 Trade school<\/li>\r\n \t<li>8 Basic AIM<\/li>\r\n \t<li>Advanced AIM<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<p class=\"import-Normal\">To add a model, we do a right mouse click on the Models folder. Then we click on Add Class.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image48-2.png\" alt=\"image\" width=\"624px\" height=\"59.9333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.55 Screenshot of adding a model.<\/p>\r\n<p class=\"import-Normal\">Models use files that have a file extension of \u201c.cs.\u201d<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image49-2.png\" alt=\"image\" width=\"624px\" height=\"432.8px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.56 Screenshot of the generic class.cs floating dialog box.<\/p>\r\n<p class=\"import-Normal\">We change the generic file name to \u201cAbout.cs\u201d and hit the \u201cAdd\u201d button.<\/p>\r\n<p class=\"import-Normal\">Figure 15.57 shows the result:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image50-2.png\" alt=\"image\" width=\"467.065196850394px\" height=\"207.028871391076px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.57 Screenshot of the empty About.cs file.<\/p>\r\n\r\n<h3>Adding the Other Web Pages to the Menu<\/h3>\r\n<p class=\"import-Normal\">You need to use the Views\/Shared\/_Layout.cshtml in order to have the items to appear on the home page.<\/p>\r\n<p class=\"import-Normal\">Notice in Figure 15.58 how the About asp-action has an entry of \u201cIndex.\u201d This is due to the placement outside of the Home folder. The other folders are inside the Home folder and thus can have unique names.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image51-2.png\" alt=\"image\" width=\"624px\" height=\"213.2px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.58 Text of the menu items.<\/p>\r\n<p class=\"import-Normal\">Figure 15.59 shows how these appear on the web page. Notice the placement of \u201cAbout\u201d outside of the Home folder does not impact how it appears on the web page.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image52-2.png\" alt=\"image\" width=\"583px\" height=\"637px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.59 View of the menu items (Mobile phone or reduced screen size view).<\/p>\r\n\r\n<table style=\"height: 76px\">\r\n<tbody>\r\n<tr class=\"TableGrid-R\" style=\"height: 61px\">\r\n<td class=\"TableGrid-C\" style=\"border: 0.5pt solid windowtext;height: 61px;width: 975.05px\">\r\n<p class=\"import-Normal\"><span style=\"color: #ff0000\">The Rick Anderson and Jon P. Smith plus 28 contributors article went into the creation of a database from inside Visual Studio. I had trouble figuring out how to link this program to an existing database. My attempts broken my program. I did not have the time to dig into the solution. So I restarted the effort without using Bootstrap.<\/span><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 975.05px\"><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2>Second Effort: ASP.NET Core with MVC and EF Core Working with an Existing Database<\/h2>\r\n<p class=\"import-Normal\">In another chapter, I had worked through the steps of installing Microsoft SQL Server Developer Edition. I used the same steps to install Microsoft SQL Server Express Edition.<\/p>\r\n<p class=\"import-Normal\">You would select which server you wish to use. See Figure 15.60.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image53-2.png\" alt=\"image\" width=\"624px\" height=\"383.8px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.60 Selecting the desired server from inside Microsoft SQL Server Management Studio<\/p>\r\n<p class=\"import-Normal\">Inside Visual Studio, you would use \u201cServer Explorer\u201d to link to the desired database server. See Figure 15.61.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image54-2.png\" alt=\"image\" width=\"233.620262467192px\" height=\"322.427926509186px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.61 Visual Studio\u2019s Server Explorer<\/p>\r\n<p class=\"import-Normal\">You will need an item known as a connection string. To see the text, do a right mouse click on the line containing \u201csqlexpress\u201d and the database name. Select \u201cProperties.\u201d The properties will appear in the lower right hand corner in the \u201cSolution Explorer.\u201d Look for the connection string inside the \u201cConnection\u201d section. See Figure 15.62.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image55-2.png\" alt=\"image\" width=\"276.023937007874px\" height=\"300.826036745407px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.62 Visual Studio\u2019s Properties panel in the Solution Explorer.<\/p>\r\n<p class=\"import-Normal\">You can copy the connection string. It will have the following appearance:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Data Source=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Trust Server Certificate=True<\/p>\r\n<p class=\"import-Normal\">I am using insights from the Pranaya Rout article. He does not include Bootstrap. That can be added after things are created.<\/p>\r\n<p class=\"import-Normal\">Open Visual Studio and select a new project. See Figure 15.9. Select \u201cASP.NET Core Web App (Model-View-Controller).\u201d See Figure 15.12. For the configure project screen, use a different name from the first efforts. For the \u201cAdditional information\u201d screen, we will have the same selections as in Figure 15.14, except we will check the \u201cDo not use top-level statements<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote12anc\" href=\"#sdfootnote12sym\">12<\/a><\/sup>.\u201d<\/p>\r\n\r\n<h3>Adding Microsoft Entity Framework Core Packages<\/h3>\r\n<p class=\"import-Normal\">As noted in the first effort, Bootstrap is included in the template. We will not repeat that discussion. We do need to add the Entity Framework Core, because it is not part of the .NET Core Framework. This task is accomplished by using the NuGet Package Manager. See Figure 15.63<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image56-2.png\" alt=\"image\" width=\"246.034330708661px\" height=\"420.058582677165px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.63 Accessing the \u201cManage NuGet Packages\u201d option via the right mouse click on the project name.<\/p>\r\n<p class=\"import-Normal\">Search for \u201cMicrosoft.EntityFrameworkCore.SQLServer.\u201d Select the desired version<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote13anc\" href=\"#sdfootnote13sym\">13<\/a><\/sup>.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image57-2.png\" alt=\"image\" width=\"624px\" height=\"391.4px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.64 The available items that contain \u201cMicrosoft.EntityFrameworkCore\u201d in the title.<\/p>\r\n<p class=\"import-Normal\">Select and install. See Figure 15.65.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image58-2.png\" alt=\"image\" width=\"530.074015748031px\" height=\"589.082204724409px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.65 The details on the Microsoft.EntityFrameworkCore.SqlServer (Note: The title is truncated in this view.)<\/p>\r\n<p class=\"import-Normal\">After hitting the \u201cInstall\u201d button, a floating dialog box appear. It has a list of other items that will be installed. Hit the \u201cOK\u201d button. The next floating dialog box is about agreeing to the terms of the license for several items. See Figure 15.66.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image59-2.png\" alt=\"image\" width=\"547px\" height=\"555px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.66 The \u201cLicense Acceptance\u201d floating dialog box.<\/p>\r\n<p class=\"import-Normal\">Hit the \u201cI Accept\u201d button.<\/p>\r\n<p class=\"import-Normal\">Repeat these steps and select the Microsoft.EntityFrameworkCore.Tools package.<\/p>\r\n<p class=\"import-Normal\">The two Microsoft.EntityFrameworkCore packages will appear in the \u201cDependencies\u201d folder. See Figure 15.67.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image60-2.png\" alt=\"image\" width=\"332.028766404199px\" height=\"156.813543307087px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.67 View of the two Microsoft.EntityFrameworkCore packages in the Dependencies folder.<\/p>\r\n\r\n<h3>Creating and Implementing the Database Context<\/h3>\r\n<p class=\"import-Normal\">The Microsoft.EntityFrameworkCore packages do not have a Visual Designer nor a Wizard. These tools were present in Microsoft.EntityFrameworkCore 6, but not in version 7 or later versions. Instead, we will be doing some <em>reverse engineering,<\/em> which is the act of recovering design information from a source. We will be using the Scaffold-DbContext command, which will examine the connected database and then generate the required context and entities.<\/p>\r\n<p class=\"import-Normal\">The Scaffold-DbContext command is a resource inside the Package Manager Console. Figure 15.68 shows how to access the Package Manager Console.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image61-2.png\" alt=\"image\" width=\"490.442519685039px\" height=\"198.417217847769px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.68 View of steps for accessing the Package Manager Console.<\/p>\r\n<p class=\"import-Normal\">The Package Manager Console will appear at the bottom of the workspace. It replaced the \u201cOutput\u201d workspace.<\/p>\r\n<p class=\"import-Normal\">The Scaffold-DbContext command format is:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Scaffold-Dbcontext &lt;Connection string using \u201cServer\u201d instead of \u201cData Source\u201d and two other changes.&gt; Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models<\/p>\r\n<p class=\"import-Normal\">For my personal computer, the connection string is:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Data Source=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Encrypt=True;Trust Server Certificate=True<\/p>\r\n<p class=\"import-Normal\">Scaffold-DbContext command needs the connection string to be modified and to become:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\"><span style=\"background-color: #ffff00\">Server<\/span>=.\\SQLEXPRESS;<span style=\"background-color: #ffff00\">Database<\/span>=ABCOMIM; Trusted_Conection=True;Trust Server Certificate=True<\/p>\r\n<p class=\"import-Normal\">Here is the full text of the Scaffold-DbContext command:<\/p>\r\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Scaffold-Dbcontext \u201cServer=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Trust Server Certificate=True;\u201d Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models<\/p>\r\n<p class=\"import-Normal\">The \u201cMicrosoft.EntityFrameworkCore.SqlServer\u201d is based on the database environment. If you were running MySQL or Oracle or another database, then this command would be different.<\/p>\r\n<p class=\"import-Normal\">The \u201c-OutputDir Models\u201d tells the command where to create the model C# files. Since we have accepted that the Model files make the actual connection to the database, then it follows that the created files should be stored in the Models folder.<\/p>\r\n<p class=\"import-Normal\">Figure 15.69 shows the command and the output.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image62-2.png\" alt=\"image\" width=\"624px\" height=\"113px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.69 View the Scaffold-DbContext command wording and its output messages.<\/p>\r\n\r\n<h4>The Odd Naming Behavior in the Context.cs File<\/h4>\r\n<p class=\"import-Normal\">Figure 15.70 shows the created C# files in the Models folder. Notice that the singular spelling is used for each database table. I do not know why Microsoft does not use the actual spelling for the database table names.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image63-2.png\" alt=\"image\" width=\"205.617847769029px\" height=\"308.026666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.70 View of the created C# files in the Models folder.<\/p>\r\n<p class=\"import-Normal\">The first file (AbcomimContext.cs) did not come from the database. This file was generated by the Scaffold-DbContext command. Notice that Microsoft used \u201cPeople\u201d in the name for the controller (PeopleController). Again, I do not know how the word \u201cPeople\u201d was used instead of \u201cPersons.\u201d In the body of some IActionResult blocks, \u201cPersons\u201d is used. See Figure 15.71 for an extract from this long file.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image64-2.png\" alt=\"image\" width=\"489.642414698163px\" height=\"612.053018372703px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.71 Extract from the ABCOMIM2.Controllers.PeopleController.<\/p>\r\n\r\n<h4>Viewing an Example Model.cs File<\/h4>\r\n<p class=\"import-Normal\">Look at Figure 15.72. These match the columns in the Persons database table. Notice the usage of the question marks for some of the headers data types and the use of the phrase \u201c= string.Empty.\u201d<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\" style=\"text-align: center\"><strong>The Person Model File Contents<\/strong><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">namespace ABCOMIM2.Models;<\/p>\r\n<p class=\"import-Normal\">public partial class Person<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">public int Id { get; set; }<\/p>\r\n<p class=\"import-Normal\">public string FirstName { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public string MiddleName { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public string LastName { get; set; } = null!;<\/p>\r\n<p class=\"import-Normal\">public string Suffix { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public string MaidenName { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public string PreferredName { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public string Title { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">public int? HomeChurchId { get; set; }<\/p>\r\n<p class=\"import-Normal\">public int? NextOfKinId { get; set; }<\/p>\r\n<p class=\"import-Normal\">public string ActiveRecord { get; set; } = string.Empty;<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.72 Extract from the ABCOMIM2.Models.Person file.<\/p>\r\n<p class=\"import-Normal\">The \u201cstring.Empty\u201d according to Microsoft should accept an absence value. I found that I had to enter something (\u201cN\/A\u201d) for MaidenName and for PreferredName. When a field is not used in the view, then a value is not needed. (You will see this in for the section entitled \u201cConfiguring the View\u201d for the ActiveRecord field.) For the question mark on the header data type, it generated a \u201cNULL\u201d entry. See Figure 15.73.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image65-2.png\" alt=\"image\" width=\"540.046824146982px\" height=\"57.6050393700787px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.73 The stored values from the program to the database.<\/p>\r\n\r\n<h4>The Warning Message in the Context Model CS File<\/h4>\r\n<p class=\"import-Normal\">In Figure 15.69, there was a warning message. This message was placed toward the end of the ABCOMIM2.Models.AbcomimContext.cs file. See Figure 15.74.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image66-2.png\" alt=\"image\" width=\"624px\" height=\"121.066666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.74 The warning message in the OnConfiguring block (Source of image: https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/)<\/p>\r\n<p class=\"import-Normal\">In plain English, the warning message is telling us that the connection string is in the Context class. This is a bad programming practice. Good programmers do not hard code certain values. The solution is to put the connection string in a file that should not be available to the visitor. So we will use the appsettings.json file. It is located near the bottom of the Solution Explorer. See Figure 15.75.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image67-2.png\" alt=\"image\" width=\"197.617112860892px\" height=\"198.417217847769px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.75 The location of the appsettings.json file.<\/p>\r\n<p class=\"import-Normal\">We will edit this file to include the connection string. Notice that we are using the original format instead of the Scaffold-DbContext format. Also notice that we had to add another backward slant bar to the server name field. Figure 15.76 shows the final version of this file.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image68-2.png\" alt=\"image\" width=\"624px\" height=\"203.133333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.76 The revised appsettings.json file.<\/p>\r\n<p class=\"import-Normal\">The last action is to edit the OnConfiguring block. See Figure 15.77.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image69-2.png\" alt=\"image\" width=\"624px\" height=\"88px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.77 The revised OnConfiguring block.<\/p>\r\n\r\n<h3>Adding the DBContext Service<\/h3>\r\n<p class=\"import-Normal\">We need to add a new block. See Figure 15.78 for the final version of the Program.cs file.<\/p>\r\n\r\n<table>\r\n<tbody>\r\n<tr class=\"TableGrid-R\">\r\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\r\n<p class=\"import-Normal\">using Microsoft.EntityFrameworkCore;<\/p>\r\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">using ABCOMIM2.Models;<\/span><\/p>\r\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">\/\/ This is needed so the program can find AbcomimContext.cs file.<\/span><\/p>\r\n<p class=\"import-Normal\">namespace ABCOMIM2<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">public class Program<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">public static void Main(string[] args)<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">var builder = WebApplication.CreateBuilder(args);<\/p>\r\n<p class=\"import-Normal\">\/\/ Add services to the container.<\/p>\r\n<p class=\"import-Normal\">builder.Services.AddControllersWithViews();<\/p>\r\n<p class=\"import-Normal\">\/<span style=\"background-color: #ffff00\">\/Adding DBContext Service<\/span><\/p>\r\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">builder.Services.AddDbContext&lt;AbcomimContext&gt;(options =&gt; options.UseSqlServer(builder.Configuration.GetConnectionString(\"DBConnection\")));<\/span><\/p>\r\n<p class=\"import-Normal\">var app = builder.Build();<\/p>\r\n<p class=\"import-Normal\">\/\/ Configure the HTTP request pipeline.<\/p>\r\n<p class=\"import-Normal\">if (!app.Environment.IsDevelopment())<\/p>\r\n<p class=\"import-Normal\">{<\/p>\r\n<p class=\"import-Normal\">app.UseExceptionHandler(\"\/Home\/Error\");<\/p>\r\n<p class=\"import-Normal\">\/\/ The default HSTS value is 30 days. You may want to change this for production scenarios, see https:\/\/aka.ms\/aspnetcore-hsts.<\/p>\r\n<p class=\"import-Normal\">app.UseHsts();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">app.UseHttpsRedirection();<\/p>\r\n<p class=\"import-Normal\">app.UseStaticFiles();<\/p>\r\n<p class=\"import-Normal\">app.UseRouting();<\/p>\r\n<p class=\"import-Normal\">app.UseAuthorization();<\/p>\r\n<p class=\"import-Normal\">app.MapControllerRoute(<\/p>\r\n<p class=\"import-Normal\">name: \"default\",<\/p>\r\n<p class=\"import-Normal\">pattern: \"{controller=Home}\/{action=Index}\/{id?}\");<\/p>\r\n<p class=\"import-Normal\">app.Run();<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\">}<\/p>\r\n<p class=\"import-Normal\"><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"import-Normal\">Figure 15.78 The final version of the Program.cs file.<\/p>\r\n\r\n<h3>Configuring the View<\/h3>\r\n<p class=\"import-Normal\">So far, we have the models and the views. We need to add a MVC Controller in order to make our program work. To do so, we need to do a right mouse click on the Controllers folder and then select Add =&gt; Controller from the context menu, as shown in Figure 15.79.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image70-2.png\" alt=\"image\" width=\"624px\" height=\"23.0666666666667px\" \/><\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image71-2.png\" alt=\"image\" width=\"624px\" height=\"336.533333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.79 Adding a controller.<\/p>\r\n<p class=\"import-Normal\">The <strong>Add<\/strong> button will cause the \u201c<strong>Add MVC Controller with views, using Entity Framework<\/strong>\u201d window to appear. From the Model class dropdown, we select the \u201c<strong>Person<\/strong>\u201d model. From the Data context class, we select AbcomimContext. We keep all other selections as they are, i.e., Generate views, Reference script libraries, and Use a layout page options checked. We add \u201cPeopleController\u201d to the Controller Name box. Figure 15.80 shows these actions and Figure 15.81 shows the final appearance.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image72-2.png\" alt=\"image\" width=\"624px\" height=\"435.2px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.80 Working with the \u201cAdd MVC Controller with views, using Entity Framework\u201d options.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image73-2.png\" alt=\"image\" width=\"624px\" height=\"439.8px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.81 Final appearance of the \u201cAdd MVC Controller with views, using Entity Framework\u201d options.<\/p>\r\n<p class=\"import-Normal\">Click the Add button. A status bar will appear. See Figure 15.82.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image74-2.png\" alt=\"image\" width=\"477.641364829396px\" height=\"132.011443569554px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.82 Scaffolding status bar.<\/p>\r\n<p class=\"import-Normal\">When the scaffolding is completed, the controller folder will have a new entry. See Figure 15.83.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image75-2.png\" alt=\"image\" width=\"330.428661417323px\" height=\"290.425196850394px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.83 The new PeopleController.<\/p>\r\n<p class=\"import-Normal\">Also, the View folder has a new addition. See Figure 15.84.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image76-2.png\" alt=\"image\" width=\"173.61501312336px\" height=\"165.6143832021px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.84 The new People view with support five actions.<\/p>\r\n<p class=\"import-Normal\">When we build the program and navigate to the URL containing \u201c\/People,\u201d the following web page will appear:<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image77-2.png\" alt=\"image\" width=\"624px\" height=\"116.333333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.85 The People web page with the headings from the database table.<\/p>\r\n<p class=\"import-Normal\">When we hit the create new link, we see the URL has updated. See Figure 15.86.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image78-2.png\" alt=\"image\" width=\"424.836850393701px\" height=\"801.669501312336px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.86 The People\/Create web page (Notice now Active Record field.)<\/p>\r\n<p class=\"import-Normal\">I added my information. See Figure 15.87.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image79-2.png\" alt=\"image\" width=\"429.637270341207px\" height=\"704.861102362205px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.87 The People\/Create web page with entries.<\/p>\r\n<p class=\"import-Normal\">Figure 15.88 shows the result of hitting the \u201cCreate\u201d button.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image80.png\" alt=\"image\" width=\"426.436955380577px\" height=\"744.064461942257px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.88 The People\/Create web page with error messages.<\/p>\r\n<p class=\"import-Normal\">I added \u201cN\/A\u201d in order to clear the error messages. Figure 15.89 shows that the view table was updated with my information.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image81.png\" alt=\"image\" width=\"624px\" height=\"160.733333333333px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.89 The People web page with an entry.<\/p>\r\n<p class=\"import-Normal\">Notice that three hyperlinks have been added to the end of the row.<\/p>\r\n<p class=\"import-Normal\">Figure 15.90 shows that the actual database has been revised.<\/p>\r\n<p class=\"import-Normal\"><img src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image82.png\" alt=\"image\" width=\"624px\" height=\"335.466666666667px\" \/><\/p>\r\n<p class=\"import-Normal\">Figure 15.90 The revised database table.<\/p>\r\n<p class=\"import-Normal\">Some sources will state that we have created<em> CRUD<\/em>. This states for Create, Read, Update, and Delete.<\/p>\r\n\r\n<h2>Final Words<\/h2>\r\n<p class=\"import-Normal\">The first effort had Bootstrap in it. The second effort did not. Why? As you noticed in the <span style=\"color: #ff0000\">red font box<\/span> at the beginning of this chapter, there are many outdated tutorials and forums on the Internet. It is very hard to find clear and current sources of information. Even Microsoft made it hard by providing a tutorial that has Visual Studio creating a database from the lines for creating a website! The Dot Net Tutorials were much better, but some of the articles have misleading titles.<\/p>\r\n<p class=\"import-Normal\">A complete website project would have stored procedures, images, and more user-friendly information.<\/p>\r\n<p class=\"import-Normal\">It is my hope that you have gained enough insights from this chapter that you could make good progress with your project.<\/p>\r\n<p class=\"import-Normal\">Maybe for the fourth edition, this chapter could be revised to include a complete example that uses Bootstrap from start to finish.<\/p>\r\n\r\n<h2>Key Terms<\/h2>\r\n<p class=\"import-Standard\"><strong>ASP.NET Core<\/strong>: This is an open source and cloud-optimized web framework. This is used for developing modern web applications that can run on Windows, on Linux, and on Mac.<\/p>\r\n<p class=\"import-Standard\"><strong>controller<\/strong>: This is responsible for working with the model.<\/p>\r\n<p class=\"import-Standard\"><strong>CRUD<\/strong>: This is an acronym that stands for Create, Read, Update, and Delete.<\/p>\r\n<p class=\"import-Normal\"><strong>Entity Framework Core<\/strong>: This contains an Object-Relational Mapping (ORM) tool that works with dates by using .NET objects.<\/p>\r\n<p class=\"import-Standard\"><strong>model<\/strong>: This performs the user\u2019s requested action.<\/p>\r\n<p class=\"import-Normal\"><strong>M<\/strong><strong>odel-<\/strong><strong>V<\/strong><strong>iew-<\/strong><strong>C<\/strong><strong>ontroller (MVC) framework<\/strong>: This is designed to separate the three parts of a program. This is known as the \u201cseparation of concerns.\u201d The user requests are routed to a controller that is responsible for working with the model. The model performs the user\u2019s requested action. This could be to retrieve the results from a query. The controller chooses the view for displaying the information back to the user. This approach means that the common actions can be used for routing to the user on a web page, to the user on a desktop application, or to the user on a kiosk in a shopping mall. One benefit is that developers can divide the project into different parts.<\/p>\r\n<p class=\"import-Normal\"><strong>reverse engineering<\/strong><strong>:<\/strong> This is the act of recovering design information from a source. I did not mention in the chapter that software reverse engineering is the process of recovering the design, the requirements specifications, and the functions of a product from analyzing a program\u2019s codes. There are courses and degree programs devoted to this area. A company may reverse engineer a product in order to determine how to build a better version.<\/p>\r\n<p class=\"import-Normal\"><strong>v<\/strong><strong>iew<\/strong><strong>:<\/strong> This is the presentation to the user.<\/p>\r\n\r\n<h2>Exercises<\/h2>\r\n<p class=\"import-Standard\">1. Explain the following terms:<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">1. ASP.NET Core<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">2. Model-View-Controller (MVC) framework [CS2023 FPL-Event-Driven and Reactive Programming KA Core 6 and ILO KA Core 4]<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">3. Model<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">4. View<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">5. Controller<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">6. Entity Framework Core<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">7. Reverse engineering<\/p>\r\n<p class=\"import-Standard\">2. Explain the role or purpose of the following:<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">1. HTML 5<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">2. Bootstrap<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">3. JavaScript<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">4. CSS<\/p>\r\n<p class=\"import-Standard\" style=\"padding-left: 40px\">[CS2023 SPD Web: Web Platforms KA Core 1]<\/p>\r\n<p class=\"import-Standard\">3. In the Entity Framework Core is the Object-Relational Mapping (ORM). This was not explained in the chapter. Do some research and explain in your own words what this is about. [CS2023 SPD Web: Web Platforms KA Core 4]<\/p>\r\n<p class=\"import-Standard\">4. Why do accessibility standards exist? [CS2023 SPD Web: Web Platforms KA Core 4]<\/p>\r\n<p class=\"import-Standard\">5. Pick a non-profit organization. Examine its website. What is the purpose of the presentation? [CS2023 SPD Web: Web Platforms Non-core 6]<\/p>\r\n<p class=\"import-Standard\">6. If you are a computing major, chances are you that you may have taken at least one computer programming course. In the final chapters of this textbook, you have worked with HTML 5, with JavaScript, with CSS, with Bootstrap, and with C#. Compare and contrast web programming with general-purpose programming. [CS2023 SPD Web: Web Platforms ILO KA Core 3]<\/p>\r\n<p class=\"import-Standard\">7. In different places in this textbook, we have talked about style guides, about accessibility, and about security programming. List at least three points how web standards have impacted software development. [CS2023 SPD Web: Web Platforms ILO KA Core 3]<\/p>\r\n\r\n<h3>Advanced questions<\/h3>\r\n<p class=\"import-Standard\">A1. Show the text from a website project that would execute a query for obtaining data from a connected database. [CS2013 IM Query Languages 5]<\/p>\r\n<p class=\"import-Standard\">A2. Add to a website project a stored procedure that receives values from the user. [CS2013 IM Query Languages 6]<\/p>\r\n\r\n<h2>A Running Project<\/h2>\r\n<p class=\"import-Standard\">For your running program, code a website CRUD operation that works with your database.<\/p>\r\n\r\n<h2>Attribution<\/h2>\r\n<p class=\"import-Standard\">This chapter of Database Design is a brand-new addition.<\/p>\r\n<p class=\"import-Standard\">This chapter drew from many sources.<\/p>\r\n\r\n<h2>Image Attribution<\/h2>\r\n<p class=\"import-Standard\">No second edition images were used.<\/p>\r\n\r\n<h2>References<\/h2>\r\n<p class=\"import-Normal\">Rick Anderson and 23 contributors. \u201cGet started with ASP.NET Core MVC,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId105\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/start-mvc?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/start-mvc?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Rick Anderson and 20 contributors. \u201cPart 2, add a controller to an ASP.NET Core MVC app,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId106\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-controller?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-controller?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Rick Anderson and 23 contributors. \u201cPart 3, add a view to an ASP.NET Core MVC app,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId107\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-view?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-view?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Rick Anderson, Jon P. Smith, and 28 contributors. \u201cPart 4, add a model to an ASP.NET Core MVC app,\u201d July 29, 2024. <a class=\"rId108\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-model?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-model?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Philip Gyllhamn. \u201cHOW TO: Create an WEB API in ASP.NET Core with SQL Database First in Visual Studio 2019,\u201d Medium, May 11. 2019.<\/p>\r\n<p class=\"import-Normal\">\u201cIntegrating Bootstrap with ASP.NET Core: Step-by-Step Guide,\u201d Web Dev Tutor, September 5, 2023.<\/p>\r\n<p class=\"import-Normal\">\u201cMVC Framework Introduction,\u201d Geeks for Geeks, July 8, 2024. <a class=\"rId109\" href=\"https:\/\/www.geeksforgeeks.org\/mvc-framework-introduction\/\"><span class=\"import-Hyperlink\">https:\/\/www.geeksforgeeks.org\/mvc-framework-introduction\/<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">\u201cOverview of ASP.NET Core MVC,\u201d Microsoft Learn, June 17, 2024. <a class=\"rId110\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/mvc\/overview?view=aspnetcore-9.0\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/mvc\/overview?view=aspnetcore-9.0<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Jan Potgieter. \u201cDevelop a Simple Web Application in ASP.NET with SQL Server,\u201d MSSQL Tips, November 15, 2022. <a class=\"rId111\" href=\"https:\/\/www.mssqltips.com\/sqlservertip\/7461\/developing-a-web-application-with-aspnet-and-sqlserver\/\"><span class=\"import-Hyperlink\">https:\/\/www.mssqltips.com\/sqlservertip\/7461\/developing-a-web-application-with-aspnet-and-sqlserver\/<\/span><\/a><\/p>\r\n<p class=\"import-Normal\">Pranaya Rout. \u201cASP.NET Core MVC with EF Core DB First Approach,\u201d Don Net Tutorials, n.d. <a class=\"rId112\" href=\"https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/\"><span class=\"import-Hyperlink\">https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/<\/span><\/a><\/p>\r\n&nbsp;\r\n<div id=\"sdfootnote1sym\"><a href=\"#sdfootnote1anc\">1<\/a> Long Term Support will receive patches for 36 months. .NET 10 is planned to be released in November 2025.<\/div>\r\n<div id=\"sdfootnote2sym\"><a href=\"#sdfootnote2anc\">2<\/a> Standard Term Support will receive patches for 18 months.<\/div>\r\n<div id=\"sdfootnote3sym\"><a href=\"#sdfootnote3anc\">3<\/a> At this writing, the current version is 2022, but 2024 is about to be released.<\/div>\r\n<div id=\"sdfootnote4sym\"><a href=\"#sdfootnote4anc\">4<\/a> The screenshots will be based on my project for a small religious institution.<\/div>\r\n<div id=\"sdfootnote5sym\"><a href=\"#sdfootnote5anc\">5<\/a> Some of the tutorials on the Web tend to suggest using .NET 9. It should not matter which version is used.<\/div>\r\n<div id=\"sdfootnote6sym\"><a href=\"#sdfootnote6anc\">6<\/a> Only one obscure website mentioned this approach: https:\/\/csharp-video-tutorials.blogspot.com\/2019\/03\/install-and-use-bootstrap-in-aspnet-core.html This website did not have a title for this information.<\/div>\r\n<div id=\"sdfootnote7sym\"><a href=\"#sdfootnote7anc\">7<\/a> While working on this chapter, I was working through the steps from the cited tutorials. I found that I needed to restart the Visual Studio project. The new effort did not have the SSL certificate issue.<\/div>\r\n<div id=\"sdfootnote8sym\"><a href=\"#sdfootnote8anc\">8<\/a> This came from \u201cHow To Set Up SSL Certificate In Visual Studio and &gt;NET CLI,\u201d CodeMaze, June 7, 2023. https:\/\/code-maze.com\/enable-ssl-certificate-visual-studio-dotnet-cli\/<\/div>\r\n<div id=\"sdfootnote9sym\"><a href=\"#sdfootnote9anc\">9<\/a>This may appear to be a silly point, but it is not. For those who live in a Linux world, software in the repository lags behind the latest version. One example of this is Apache NetBeans.<\/div>\r\n<div id=\"sdfootnote10sym\"><a href=\"#sdfootnote10anc\">10<\/a> Recall from another chapter the example of what defines a full-time student or what defines a full teaching load. One institution might define that a full-time student is one who takes 9 credit hours while another institution might define a full-time student as one who takes 12 credit hours.<\/div>\r\n<div id=\"sdfootnote11sym\"><a href=\"#sdfootnote11anc\">11<\/a> Recall that there are two approaches. One approach is to have an ID number generated for each table. The other approach is to depend upon the combinations of values for defining a unique row. At this writing, I went with the second approach. So the PersonID is a foreign key, but it is a primary key when combined with another column.<\/div>\r\n<div id=\"sdfootnote12sym\"><a href=\"#sdfootnote12anc\">12<\/a> Java is my favorite programming language. I have come late to the C# party. I have wanted to see the \u201chidden\u201d C# lines so I can gain a better understanding of the coding. Rout and other more experienced C# programmers tend to opt out on seeing these \u201cboilerplate\u201d top-level lines. If you are still learning C#, then you might wish to leave this check box unchecked.<\/div>\r\n<div id=\"sdfootnote13sym\"><a href=\"#sdfootnote13anc\">13<\/a> You may not be given a choice. So select what is provided.<\/div>\r\n<\/div>","rendered":"<div class=\"chapter-15-more-on-an-example-website-with-a-database-connection\">\n<p class=\"import-Standard\">Original Material to the textbook: Fred Strickland<\/p>\n<h2>Learning Outcomes<\/h2>\n<table style=\"width: 467.5pt\">\n<tbody>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\"><strong>Computing Sub Discipline<\/strong><\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\"><strong>Document Code, Reference Code, and Page Number<\/strong><\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\"><strong>Text<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;border-top: solid #00000A 0.5pt;border-right: solid #00000A 0.5pt;border-left: solid #00000A 0.5pt;padding: 0pt 5.4pt 0pt 5.65pt\" rowspan=\"5\">\n<p class=\"import-Standard\">Computer Science<\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">CS2013<\/p>\n<p class=\"import-Standard\">IM\/Query Languages<\/p>\n<p class=\"import-Standard\">(Page 1136)<\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">5. Embed object-oriented queries into a stand-alone language such as C++ or Java (e.g., SELECT Col.Method() FROM Object). [Usage]<\/p>\n<p class=\"import-Standard\">6. Write a stored procedure that deals with parameters and has some control flow, to provide a given functionality. [Usage]<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">CS2023<\/p>\n<p class=\"import-Standard\">DM-Core: Core Database Systems Concepts<\/p>\n<p class=\"import-Standard\">(Pages 115-116)<\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">CS Core 8. How to support CRUD-only applications<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">CS2023<\/p>\n<p class=\"import-Standard\">DM-NoSQL: NoSQL Systems<\/p>\n<p class=\"import-Standard\">(Pages 120-121)<\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">KA Core 1. Why NoSQL? (e.g., Impedance mismatch between Application [CRUD] and RDBMS)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: 0.5pt solid #00000a\">CS2023<\/p>\n<p>FPL<a href=\"#_ftn1\">[1]<\/a>-Event-Driven:\u00a0 Event-Driven and Reactive Programming<\/p>\n<p class=\"import-Standard\">(Pages 134-135)<\/p>\n<div>\n<div>\n<p><a href=\"#_ftnref1\">[1]<\/a> Foundations of Programming Languages (FPL)\u00a0 The ACM has added the Model View Controller as a learning outcome in the Software Engineering Design Software Design area.\u00a0 See page 243 in CS2023.<\/p>\n<\/div>\n<\/div>\n<\/td>\n<td style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: 0.5pt solid #00000a\">KA Core 6.\u00a0 Separation of model, view, and controller.<\/p>\n<p class=\"import-Standard\">ILO KA Core 4.\u00a0 Describe an interactive system in terms of a model, a view, and a controller<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">CS2023<\/p>\n<p class=\"import-Standard\">SPD Web: Web Platforms<\/p>\n<p class=\"import-Standard\">(Page 302)<\/p>\n<\/td>\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">KA Core 1. Web programming languages (e.g., HTML5, JavaScript \u2026, CSS)<\/p>\n<p class=\"import-Standard\">KA Core 4. Web standards such as document object model, accessibility.<\/p>\n<p class=\"import-Standard\">Non-core 6. Analyzing requirements for web applications<\/p>\n<p class=\"import-Standard\">ILO KA Core 3. Compare and contrast web programming with general-purpose programming.<\/p>\n<p class=\"import-Standard\">ILO KA Core 5. Discuss how web standards impact software development.<\/p>\n<p class=\"import-Standard\">\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Introduction to Chapter 15<\/h2>\n<p class=\"import-Normal\">In Chapter 14, we looked at creating a front end that could interact with a database. The examples were based on Bootstrap 5. Since we did not add any JavaScript code, there was no functionality to the created web page. For this chapter, we have the same learning outcomes as for Chapter 14 plus the addition of CS2023 ILO KA Core 3.<\/p>\n<p class=\"import-Standard\">We will not repeat the paragraphs on website design. Nor will we repeat the paragraphs on how to design a good database. We will assume that we understand these concepts.<\/p>\n<p class=\"import-Standard\">We will be working with ASPNET Core, Entity Framework Core, Model-View-Controller framework, Bootstrap 5 with JavaScript, code-behind, and a SQL Server Management database.<\/p>\n<h2>The Third Edition Style Guide<\/h2>\n<p class=\"import-Standard\">This is the style guide that this book will follow for this chapter and for the other chapters.<\/p>\n<table style=\"width: 229.25pt\">\n<tbody>\n<tr class=\"TableNormal-R\">\n<td class=\"TableNormal-C\" style=\"background-color: transparent;padding: 0pt 5.4pt 0pt 5.65pt;border: solid #00000A 0.5pt\">\n<p class=\"import-Standard\">Naming Convention:<\/p>\n<ul>\n<li>All English names<\/li>\n<li>Plural table names<\/li>\n<li>Singular column names<\/li>\n<li>Capitalized words<\/li>\n<li>Pascal Case for composite names<\/li>\n<li>No underscores or special characters<\/li>\n<li>No unique SQL commands<\/li>\n<li>No object prefixes<\/li>\n<\/ul>\n<p class=\"import-Standard\">Using the IE\u2019s Notation with Crow\u2019s Foot Notation.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Standard\">Figure 15.1 The database style guide. Adapted from https:\/\/vertabelo.com\/blog\/database-schema-naming-conventions\/<\/p>\n<p class=\"import-Standard\">The examples will conform to the style guide.<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Standard\"><span style=\"color: #ff0000\">The material in this chapter covers cutting edge technology. This area is changing rapidly. If you should decide to explore tutorials on the Internet, there are some cautions:<\/span><\/p>\n<ul>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid ASP.NET Core 6 and older. Microsoft made a major change. I used ASP.NET Core 8 for this chapter. ASP.NET Core 9 was out, but it is an 18-month edition.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid ADO.NET. This has been replaced by Entity Framework Core.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid very old editions of Visual Studio. As of this writing, 2022 is the most current edition.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid instructions on how to add Bootstrap to a Visual Studio project. Recent editions of Visual Studio include Bootstrap in the provided project templates.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid instructions pertaining to Microsoft.EntityFrameworkCore 6.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid any instructions that mention Start.cs. Program.cs is the correct file name.<\/span><\/li>\n<li class=\"import-Standard\"><span style=\"color: #ff0000\">Avoid any instructions that mention JQuery and Bootstrap. JQuery was added in Bootstrap 3 and was dropped in Bootstrap 5.<\/span><\/li>\n<\/ul>\n<p class=\"import-Standard\"><span style=\"color: #ff0000\">This chapter may appear disjointed. I wanted to wrap up this project before the start of 2025.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>The Project: A Small Religious Educational Institution<\/h2>\n<h3>Storyboarding<\/h3>\n<p class=\"import-Normal\">We will storyboard the website and we will use the University of Notre Dame approach. Here is the first navigation row:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image1-11.png\" alt=\"image\" width=\"449.638950131234px\" height=\"129.611233595801px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.2 First navigation row.<\/p>\n<p class=\"import-Normal\">Here is the second navigation row:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image2-11.png\" alt=\"image\" width=\"460.839895013123px\" height=\"108.009343832021px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.3 Second navigation row.<\/p>\n<p class=\"import-Normal\">Under the \u201cAbout\u201d tab is information about the leadership, about the offices, about the history, about the mission, about notable alumni, about commitments, about financial information, and about a contact link. The middle has some text about the history of the university. On the far right is a quote. Scrolling down is information about the number of majors, colleges and schools, and the ranking based on several respectable authorities. There is more information.<\/p>\n<p class=\"import-Normal\">Under the \u201cVisit\u201d tab is information about the campus and the nearby area.<\/p>\n<p class=\"import-Normal\">In the second row is where one would find more detailed information. The \u201cAcademics\u201d tab has the academic units, the various academic programs, and other items. I did notice that a visitor would keep going deeper and deeper into the website. What I found troubling is the absence of a traditional catalog with academic plans and course descriptions.<\/p>\n<p class=\"import-Normal\">The \u201cAdmissions\u201d tab has a link to an application and another link to financial aid. It takes several mouse clicks to reach the actual form. And the actual application is hosted on three different third-party websites. A person must create an account before going forward. This has the benefit of saving the entries, but it has the disadvantage of preventing a person from previewing the questions.<\/p>\n<p class=\"import-Normal\">You may continue to explore the remaining tabs.<\/p>\n<p class=\"import-Normal\">As a personal note, I could not find on the University of Norte Dame website the traditional catalog. This is a large book that contains detailed information about the policies, about the programs, about the courses, about the faculty, and about other important items. I had the same issue with the Douglas College website. Has this document become obsolete? The answer is \u201cNo.\u201d Recall from Chapter 14 that Abhijeet Kaldate had a list of noteworthy higher education institutions. Let\u2019s look at Syracuse University in central New York.<\/p>\n<p class=\"import-Normal\">The Syracuse University navigation bar is simpler.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image3-13.png\" alt=\"image\" width=\"624px\" height=\"54.2666666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.4 The main Syracuse University navigation bar.<\/p>\n<p class=\"import-Normal\">Under the \u201cAcademics\u201d tab is the link to the catalog. The label is \u201cCourse Catalog.\u201d This label is a bit misleading since this contains more than just course information.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image4-12.png\" alt=\"image\" width=\"425.059317585302px\" height=\"806.112545931759px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.5 The Syracuse University academic drop down list.<\/p>\n<p class=\"import-Normal\">After some pondering, here is the new storyboard:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image5-13.png\" alt=\"image\" width=\"449.638950131234px\" height=\"50.4044094488189px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.6 Proposed Website (Unfortunately, the image is fuzzy.)<\/p>\n<p class=\"import-Normal\">The storyboard is very small. Here is an outline of the proposed website below the home page:<\/p>\n<ul>\n<li><strong>About<\/strong>\n<ul>\n<li>Leadership\n<ul>\n<li>Director<\/li>\n<li>Registrar and Financial Secretary<\/li>\n<li>Treasurer<\/li>\n<li>Assistant Treasurer<\/li>\n<li>Dean \u2013 Central Area<\/li>\n<li>Dean \u2013 Portland Area<\/li>\n<li>Dean \u2013 Aroostook County<\/li>\n<li>Dean \u2013 Bangor Area<\/li>\n<\/ul>\n<\/li>\n<li>Offices\n<ul>\n<li>An A through Z list<\/li>\n<\/ul>\n<\/li>\n<li>History\n<ul>\n<li>When was the ABCOM Institute for Ministry founded?<\/li>\n<li>The first involved individuals.<\/li>\n<li>Sponsoring Organization: The American Baptist Churches of Maine<\/li>\n<\/ul>\n<\/li>\n<li>Mission and Vision\n<ul>\n<li>Serving Leaders in Maine and Beyond<\/li>\n<li>The Mission is to provide ongoing theological, ministry, and discipleship education to pastoral leadership and laity in Maine.<\/li>\n<\/ul>\n<\/li>\n<li>Contact\n<ul>\n<li>Admissions Questions<\/li>\n<li>General Information Questions<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Academics<\/strong>\n<ul>\n<li>Programs\n<ul>\n<li>Basic Diploma Program<\/li>\n<li>Field Guidance Program<\/li>\n<li>Advanced Studies Program<\/li>\n<\/ul>\n<\/li>\n<li>Libraries\n<ul>\n<li>Housed and Shared Locations<\/li>\n<\/ul>\n<\/li>\n<li>Academic Calendar<\/li>\n<li>The Catalog\n<ul>\n<li>In PDF<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Admissions<\/strong>\n<ul>\n<li>Why ABCOM Institute for Ministry (AIM)?<\/li>\n<li>Application Process<\/li>\n<li>Financial Information\n<ul>\n<li>Annual Tuition and Fees<\/li>\n<\/ul>\n<\/li>\n<li>Financial Aid<\/li>\n<li>Students Profile<\/li>\n<li>Request for Information<\/li>\n<\/ul>\n<\/li>\n<li><strong>Faith &amp; Service<\/strong>\n<ul>\n<li>Opportunities<\/li>\n<li>Employment<\/li>\n<li>Churches<\/li>\n<li>News<\/li>\n<\/ul>\n<\/li>\n<li><strong>Give<\/strong>\n<ul>\n<li>Why Give<\/li>\n<li>Ways to Give<\/li>\n<\/ul>\n<\/li>\n<li><strong>Alumni<\/strong>\n<ul>\n<li>Brian Casey<\/li>\n<li>John Cheney<\/li>\n<li><strong>Others<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>The Home Page<\/h3>\n<p class=\"import-Normal\">This small religious educational institution does not perform cutting edge research nor has interesting news stories to share. We could have the following arrangement:<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Logo navigation<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Faith &amp; Service item<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Mission statement<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Calendar<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Footer<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Logo with social media links<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">More navigation buttons.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.7 Proposed Website home page<\/p>\n<h2>First Effort: Working with ASP.NET Core<\/h2>\n<p class=\"import-Normal\"><em>ASP.NET<\/em><em> Core<\/em> is an open source and cloud-optimized web framework. This is used for developing modern web applications that can run on Windows, on Linux, and on Mac. It includes the <em>M<\/em><em>odel-<\/em><em>V<\/em><em>iew-<\/em><em>C<\/em><em>ontroller (MVC) framework<\/em>, which is designed to separate the three parts of a program. The Entity Framework Core contains an Object-Relational Mapping (ORM) tool that works with data by using .NET objects.<\/p>\n<p class=\"import-Normal\">Check the edition of the .NET Core framework. On my older laptop, I had 7.0 and the support had ended in May 2024. If you have an older version, you could update or just do a removal-and-fresh-install. As of this writing, .NET 8.0 (Long Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote1anc\" href=\"#sdfootnote1sym\">1<\/a><\/sup> and .NET 9.0 (Standard Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote2anc\" href=\"#sdfootnote2sym\">2<\/a><\/sup>.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image6-12.png\" alt=\"image\" width=\"624px\" height=\"126.933333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.8 Screenshot of the .NET selection dropdown menu.<\/p>\n<p class=\"import-Normal\">Open Visual Studio<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote3anc\" href=\"#sdfootnote3sym\">3<\/a><\/sup> and select \u201cCreate a new project.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image7-14.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.9 The opening screen for Visual Studio 2022.<\/p>\n<p class=\"import-Normal\">In the Jan Potgieter article, the next step was to \u201cChoose ASP.Net Web Application (.Net Framework) template.\u201d In Visual Studio 2022, this entry does not exist. The closest entry is \u201cASP.Net Core Web App (Razor Pages)\u201d and \u201cASP.NET Core Web App (Model-View-Controller).\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image8-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.10 Visual Studio 2022 new project list (Filtered by the phrase of \u201cweb app.\u201d)<\/p>\n<p class=\"import-Normal\">Razor Pages technology makes coding page-focused scenarios easier and more productive than using controllers and views. Recall that the Model-View-Controller (MVC) is a framework that separates an application into three main logical components (the model, the view, and the controller). This is an approach that supports many developers working at the same time. This is known as \u201cseparation of concerns.<\/p>\n<p class=\"import-Normal\">With the \u201cseparation of concerns\u201d pattern, the user requests are routed to a <em>controlle<\/em>r that is responsible for working with the model. The <em>model <\/em>performs the user\u2019s requested action. This could be to retrieve the results from a query. The controller chooses the <em>view<\/em> for displaying the information back to the user. This approach means that the common actions can be used for routing to the user on a web page, to the user on a desktop application, or to the user on a kiosk in a shopping mall. The Figure 15.11 image is from the article entitled &#8220;Overview of ASP.NET Core MVC\u201d and this illustrates these actions nicely.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image9-8.png\" alt=\"image\" width=\"327.2px\" height=\"313.6px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.11 Image of the MVC approach. Source of image: From the Internet<\/p>\n<p class=\"import-Normal\">Since MVC \u201cis one of the most frequently used industry-standard web development frameworks\u201d for creating scalable projects, we will use that approach. Choose the C# version.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image10-10.png\" alt=\"image\" width=\"624px\" height=\"143.866666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.12 Close up of the new \u201cASP.NET Core Web App (Model-View-Controller\u201d project menu item.<\/p>\n<p class=\"import-Normal\">Hit \u201cNext.\u201d On the \u201cConfigure your new project\u201d screen use the following entries:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Project name: ExampleWebApplication<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote4anc\" href=\"#sdfootnote4sym\">4<\/a><\/sup><\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Accepting the default entries.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image11-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.13 Configure the project screen.<\/p>\n<p class=\"import-Normal\">Although the Jan Potgieter article was published in 2022, she is using Visual Studio 2019 and Microsoft NET Framework Version 4.8.04084. Philip Gyllhamn wrote his article in 2019 and he is using Visual Studio 2019 and ASP.NET Core 2.1. He is creating an actual web page and so we will follow some of his steps.<\/p>\n<p class=\"import-Normal\">In the next screen, Select \u201c.NET 8. (Long Term Support)<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote5anc\" href=\"#sdfootnote5sym\">5<\/a><\/sup>,\u201d no authentication type, configure for HTTPS. Then hit the create button.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image12-10.png\" alt=\"image\" width=\"624px\" height=\"415.333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.14 Additional information screen.<\/p>\n<p class=\"import-Normal\">Here is the working home screen for the project:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image13-10.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.15 The opening screen for the project.<\/p>\n<h3>Adding Bootstrap 5 to the Project<\/h3>\n<p class=\"import-Normal\">From Chapter 14, we learned that we can reference the Bootstrap library on another website by adding a line to the header block. There are other ways of adding Bootstrap support within Visual Studio:<\/p>\n<ul>\n<li>Enter the line manually into the text. (The approach was used by Jan Potgieter.)<\/li>\n<li>Add the Content Delivery Network (CDN) line to the project layout file (usually named as _Layout.cshtml).<\/li>\n<\/ul>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image14-9.png\" alt=\"image\" width=\"388.054173228346px\" height=\"528.073700787402px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.16 Screenshot of the Solution Explorer screen.<\/p>\n<ul>\n<li>Bootstrap support may be already present. See Figure 15.17.<\/li>\n<\/ul>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image15-10.png\" alt=\"image\" width=\"624px\" height=\"150.6px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.17 Screenshot of the top of the _Layout.cshtml file.<\/p>\n<ul>\n<li>Use the Node Package Manager (NPM) to import the actual Bootstrap files into the project.<\/li>\n<li>Use the NuGet package manager to import the actual Bootstrap files into the project.<\/li>\n<li>Use the LibMan<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote6anc\" href=\"#sdfootnote6sym\">6<\/a><\/sup>.<\/li>\n<\/ul>\n<p class=\"import-Normal\">When we selected the \u201ccreate HTTP option,\u201d Bootstrap support was added to the project. So we do not need to take any action about adding Bootstrap support.<\/p>\n<p class=\"import-Normal\">Figure 15.18 shows more of the _Layout.cshtml file.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image16-9.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.18 Screenshot of more lines of the _Layout.cshtml file.<\/p>\n<h3>Executing the MVC Program the First Time<\/h3>\n<p class=\"import-Normal\">To see what has been done for us, hit the run button. <img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image17-10.png\" alt=\"image\" width=\"78.0109186351706px\" height=\"27.0037795275591px\" \/><\/p>\n<p class=\"import-Normal\">If a floating dialog box appears, hit \u201cYes.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image18-8.png\" alt=\"image\" width=\"609px\" height=\"227px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.19 Screenshot of the floating dialog box on the SSL Certificate.<\/p>\n<p class=\"import-Normal\">Hit \u201cYes\u201d on the second floating dialog box.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image19-8.png\" alt=\"image\" width=\"512px\" height=\"475px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.20 Screenshot of the floating dialog box on a security warning.<\/p>\n<p class=\"import-Normal\">Hit \u201cYes\u201d on the third floating dialog box.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image20-8.png\" alt=\"image\" width=\"609px\" height=\"253px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.21 Screenshot of the floating dialog box about the IIS Express SSL certificate.<\/p>\n<p class=\"import-Normal\"><a id=\"_Hlk185746719\"><\/a>Hit \u201cYes.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image21-8.png\" alt=\"image\" width=\"552px\" height=\"528px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.22 Screenshot of the floating dialog box about the second security warning.<\/p>\n<p class=\"import-Normal\">Hit \u201cYes.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image22-8.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.23 Screenshot of the floating dialog box about the connection not being private.<\/p>\n<p class=\"import-Normal\">Hit \u201cAdvanced.\u201d Figure 15.24 shows the text from the \u201cAdvanced\u201d button.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image23-8.png\" alt=\"image\" width=\"624px\" height=\"291.133333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.24 Screenshot of the floating dialog box about the connection not being private.<\/p>\n<p class=\"import-Normal\">According to the article entitled \u201cGet started with ASP.NET Core MVC,\u201d this should have worked. For me, it did not<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote7anc\" href=\"#sdfootnote7sym\">7<\/a><\/sup>. A quick fix<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote8anc\" href=\"#sdfootnote8sym\">8<\/a><\/sup> is to use http instead of https:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image24-8.png\" alt=\"image\" width=\"108.015118110236px\" height=\"129.017952755906px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.25 Screenshot of the HTTP\/HTTPS options.<\/p>\n<p class=\"import-Normal\">Now hitting the run button will present the web page:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image25-8.png\" alt=\"image\" width=\"624px\" height=\"331.533333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.26 Screenshot of the executing program.<\/p>\n<p class=\"import-Normal\">You must close the entire web browser session, not just the web page before you can do any further editing.<\/p>\n<p class=\"import-Normal\">We can begin to make some changes to this part of the program.<\/p>\n<h3>Which Bootstrap Version is Visual Studio Using?<\/h3>\n<p class=\"import-Normal\">When the web page is displayed, hit \u201cControl U\u201d on your keyboard. You will see the\u201d rel\u201d lines as hyper links.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image26-8.png\" alt=\"image\" width=\"624px\" height=\"146.8px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.27 Screenshot of the HTML header lines.<\/p>\n<p class=\"import-Normal\">Click on the line containing \u201cbootstrap.min.css.\u201d You will see the actual version number in the second line.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image27-7.png\" alt=\"image\" width=\"624px\" height=\"89px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.28 Screenshot of the bootstrap.min.css lines.<\/p>\n<p class=\"import-Normal\">Now, close the example web page. To obtain the latest version, do a right mouse click on the project name in the \u201cSolution Explorer\u201d box. Look for the \u201cAdd\u201d line. Follow this to the \u201cClient-Side Library.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image28-11.png\" alt=\"image\" width=\"624px\" height=\"493.666666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.29 Screenshot of the adding \u201cClient-Side Library.\u201d<\/p>\n<p class=\"import-Normal\">In the search box (the second box), type \u201cBootstrap.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image29-8.png\" alt=\"image\" width=\"624px\" height=\"437.266666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.30 Screenshot of the available bootstrap versions.<\/p>\n<p class=\"import-Normal\">It will display the current version available. In December 2024, it is 5.3.3. On the Bootstrap website, the last update was 5.3.3<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote9anc\" href=\"#sdfootnote9sym\">9<\/a><\/sup>. Since the default version is older, we will install the latest version. The Output box will show the steps. Notice that the Bootstrap files were installed on the hard drive.<\/p>\n<h3>Adding Bootstrap Lines to the _Layout.cshtml File<\/h3>\n<p class=\"import-Normal\">An integrated development environment (IDE) may use \u201ccode complete.\u201d For example, on the second line, starting typing \u201c&lt;!&#8211;.\u201d When you hit the space bar, the closing piece will appear. Be careful when you move your cursor around. If the ending piece does not have two hyphens, then the web page will not display.<\/p>\n<p class=\"import-Normal\">I began to edit the web page. As I did for Douglas College, I found the URL for the American Baptist Churches USA. For some strange reason, the image would not display. The alternate text would display. So I changed the URL for the American Baptist Churches of Maine logo that would display.<\/p>\n<p class=\"import-Normal\">Using the generated HTML code solved many issues. For example, the generated code has the top menu on every web page. Here is what I have so far:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image30-7.png\" alt=\"image\" width=\"624px\" height=\"682.2px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.31 Screenshot of the executing website.<\/p>\n<h3>More About the MVC Approach<\/h3>\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The model represents the data. It is here that we would validate the user\u2019s input and enforce any business rules<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote10anc\" href=\"#sdfootnote10sym\">10<\/a><\/sup>. We would use the model to work with a database.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image31-6.png\" alt=\"image\" width=\"275.03842519685px\" height=\"117.016377952756px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.32 Screenshot of the model tree.<\/p>\n<h3>More About the MVC View<\/h3>\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The view displays something to the user. So for this effort, it is a web page. Again, the user interface logic is stored in the view. The view does not handle business logic. Nor does the view interact with a database directly.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image32-7.png\" alt=\"image\" width=\"207.028871391076px\" height=\"103.0143832021px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.33 Screenshot of the view tree.<\/p>\n<h3>More About the MVC Controller<\/h3>\n<p class=\"import-Normal\">Recall that the MVC pattern separates an application into three components. The controller handles the web browser requests, retrieves the model\u2019s data, and calls upon the proper view template for displaying the information.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image33-6.png\" alt=\"image\" width=\"411.057322834646px\" height=\"193.026981627297px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.34 Screenshot of the controller tree.<\/p>\n<h3>Adding a Controller<\/h3>\n<p class=\"import-Normal\">There are two ways of adding a controller. One way is outside of the HomeController. The other way is to add to the HomeController. We see both approaches.<\/p>\n<h4>Adding a Controller Outside of the HomeController<\/h4>\n<p class=\"import-Normal\">In the Solution Explorer, do a right mouse click on \u201cController\u201d and select \u201cAdd Controller.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image34-6.png\" alt=\"image\" width=\"624px\" height=\"87.1333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.35 Screenshot of adding a controller outside of the HomeController.<\/p>\n<p class=\"import-Normal\">In the \u201cAdd New Scaffolded Item\u201d dialog box, select \u201cMVC Controller Empty Add.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image35-7.png\" alt=\"image\" width=\"624px\" height=\"431.133333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.36 Screenshot of adding a controller outside of the HomeController: Adding the scaffolding lines.<\/p>\n<p class=\"import-Normal\">Replace the default entry of \u201cHomeController1.cs\u201d with \u201cAbout.cs\u201d and hit the \u201cAdd\u201d button.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image36-4.png\" alt=\"image\" width=\"624px\" height=\"432.8px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.37 Screenshot of adding a controller outside of the HomeController: Selecting the desired web item.<\/p>\n<p class=\"import-Normal\">See Figure 15.38 for the result of this action:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image37-4.png\" alt=\"image\" width=\"624px\" height=\"121.266666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.38 Screenshot of the results of adding a controller outside of the HomeController.<\/p>\n<p class=\"import-Normal\">We can test out the C# code. Change the default text to look like Figure 15.39:<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">public class About : Controller<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">\/\/public IActionResult Index()<\/p>\n<p class=\"import-Normal\">\/\/ GET: \/About\/<\/p>\n<p class=\"import-Normal\">public string Index()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">\/\/ return View();<\/p>\n<p class=\"import-Normal\">return &#8220;This is a test string from the About C# file.&#8221;;<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">\/\/<\/p>\n<p class=\"import-Normal\">\/\/ GET: \/About\/Welcome\/<\/p>\n<p class=\"import-Normal\">public string Welcome()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">return &#8220;This is the Welcome action method&#8230;&#8221;;<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.39 C# code for the About Controller<\/p>\n<p class=\"import-Normal\">Execute the file. Do the following actions in order:<\/p>\n<ul>\n<li>After the port number, add \u201c\/About\u201d (Figure 15.40) to the end of the URL and hit the enter key.<\/li>\n<\/ul>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image38-5.png\" alt=\"image\" width=\"418.058372703412px\" height=\"125.017427821522px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.40 Screenshot of executing the About web page.<\/p>\n<ul>\n<li>After \u201c\/About,\u201d add \u201c\/Welcome\u201d and hit the enter key.<\/li>\n<\/ul>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image39-6.png\" alt=\"image\" width=\"437.060997375328px\" height=\"121.016902887139px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.41 Screenshot of executing the About\/Welcome web page.<\/p>\n<h4>Adding to the HomeController<\/h4>\n<p class=\"import-Normal\">This is the second approach. In the Solution Explorer, click on the \u201cHomeController.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image40-6.png\" alt=\"image\" width=\"404.056377952756px\" height=\"221.030866141732px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.42 Screenshot of the HomeController tree.<\/p>\n<p class=\"import-Normal\">Copy the IActionResult block from Figure15.43 and paste it in the order that you wish the item to appear in the menu. The Figure 15.43 shows the addition of \u201cAcademics\u201d and \u201cFaith &amp; Service:\u201d<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">public IActionResult Index()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">return View();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">public IActionResult Academics()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">return View();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">public IActionResult FaithAndService()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">return View();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">public IActionResult Privacy()<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">return View();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.43 The IActionResult blocks.<\/p>\n<h3>Adding a View<\/h3>\n<p class=\"import-Normal\">We want the view component to handle the display of our information. From Figure 15.6, we know that we need to add a view element for \u201cAbout,\u201d for \u201cAcademics,\u201d for \u201cAdmissions,\u201d for \u201cFaith &amp; Service,\u201d for \u201cGive,\u201d and for \u201cAlumni.\u201d There are two ways of adding a view. One way is outside of the Home folder. The other way is to add to the Home folder.<\/p>\n<h4>Adding a View Outside of the Home Folder<\/h4>\n<p class=\"import-Normal\">Right-click on the Views folder, and then <strong>Add <\/strong><strong>&#8211;<\/strong><strong>&gt; New Folder<\/strong> and name the folder \u201cAbout.\u201d See Figure 15.44.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image41-5.png\" alt=\"image\" width=\"624px\" height=\"468.933333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.44 The first step of adding a View.<\/p>\n<p class=\"import-Normal\">Right-click on the Views\/About folder, and then Add &gt; New Item. See Figure 15.45.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image42-5.png\" alt=\"image\" width=\"624px\" height=\"475.666666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.45 The second step of adding a View.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image43-2.png\" alt=\"image\" width=\"624px\" height=\"433px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.46 The result of the second step of adding a View.<\/p>\n<p class=\"import-Normal\">Select the \u201cRazor View \u2013 Empty.\u201d Notice that the \u201cName\u201d field changes to read \u201cIndex.cshtml.\u201d See Figure 15.47.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image44-2.png\" alt=\"image\" width=\"624px\" height=\"433px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.47 The result of selecting \u201cRazor View \u2013 Empty\u201d in the second step of adding a View.<\/p>\n<p class=\"import-Normal\">Hit the \u201cAdd\u201d button. The dialog box goes away and a empty file appears. See Figure 15.48.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image45-2.png\" alt=\"image\" width=\"624px\" height=\"93.4px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.48 The empty \u201cIndex.cshtml\u201d file.<\/p>\n<p class=\"import-Normal\">Replace canned lines with the following:<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">@{<\/p>\n<p class=\"import-Normal\">ViewData[&#8220;Title&#8221;] = &#8220;Index&#8221;;<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">&lt;h2&gt;Index About&lt;\/h2&gt;<\/p>\n<p class=\"import-Normal\">&lt;p&gt;Hello from our About View Template!&lt;\/p&gt;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.49 The replacement lines in the \u201cIndex.cshtml\u201d file.<\/p>\n<p class=\"import-Normal\">Edit the Controller file to read:<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">namespace ABCOMIMWebApplication.Controllers<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">public class About : Controller<\/p>\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">{<\/p>\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">public IActionResult Index()<\/p>\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">{<\/p>\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">return View();<\/p>\n<p class=\"import-Normal\" style=\"text-indent: 12pt\">}<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.50 The revised lines in the About Controller file.<\/p>\n<p class=\"import-Normal\">Now execute the web page with About in the address bar:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image46-2.png\" alt=\"image\" width=\"624px\" height=\"685px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.51 The result of executing the revised About web page.<\/p>\n<h4>Adding a View Inside the Home Folder<\/h4>\n<p class=\"import-Normal\">Right-click on the Home folder inside the Views folder, and then Add &gt; New Item. Name it \u201cAcademics.\u201d<\/p>\n<p class=\"import-Normal\">In the search box in the upper-right, enter view.<\/p>\n<p class=\"import-Normal\">Select Razor View \u2013 Empty.<\/p>\n<p class=\"import-Normal\">Replace the canned lines with the following:<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">@{<\/p>\n<p class=\"import-Normal\">ViewData[&#8220;Title&#8221;] = &#8220;Academics&#8221;;<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">&lt;h1&gt;@ViewData[&#8220;Title&#8221;]&lt;\/h1&gt;<\/p>\n<p class=\"import-Normal\">&lt;p&gt;Use this page to detail the academics.&lt;\/p&gt;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.52 The revised lines for adding the \u201cAcademics\u201d view to the Home Folder<\/p>\n<p class=\"import-Normal\">These steps could be repeated for other views. See Figure 15.53 for \u201cAcademics\u201d and for \u201cFaithAndService.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image47-2.png\" alt=\"image\" width=\"184.816062992126px\" height=\"156.013543307087px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.53 Showing views outside of the \u201cHome\u201d folder and inside the \u201cHome\u201d folder.<\/p>\n<h3>Adding a Model<\/h3>\n<p class=\"import-Normal\">Recall that the model does the actual interfacing with a database. We will create classes for working with a database. The Rick Anderson and Jon P. Smith article is about creating a movies database from the website side. That may not be the case when a database exists already. Rick Anderson and Jon P. Smith do not mention in their article that there is a weakness with their approach. The weakness is that any database created through this avenue may not be well defined. All the needed tables and fields may not be created and normalization issues may be present.<\/p>\n<p class=\"import-Normal\">For the small religious educational institution, I am working with the following tables:<\/p>\n<ul>\n<li>Persons (These are the common elements for anyone associated with American Baptist Churches of Maine Institute of Ministry (ABCOMIM). I do not have a position or role in this table, because a person could be filling more than one role. I am not storing the date of birth, the gender, and the government ID number. I do not perceive these items as being necessary. Website visitors will not have access to the entire table. We will pull from this table and from another table for populating the \u201cLeadership\u201d web page.\n<ul>\n<li>ID Number (Generated by the database table.)<\/li>\n<li>Title (Mr., Mrs., Ms., Dr., and so on)<\/li>\n<li>First Name<\/li>\n<li>Middle Name<\/li>\n<li>Last Name<\/li>\n<li>Maiden Name<\/li>\n<li>Preferred Name<\/li>\n<li>Suffix<\/li>\n<li>Home Church (Use an ID here and reference another table.)<\/li>\n<li>Education (This is not stored in this table. We reference another table, because a person could have more than one degree.)<\/li>\n<li>Next of Kin (Use an ID here and reference this table.)<\/li>\n<li>Active (Yes or No. This avoids the need for an archive table.)<\/li>\n<\/ul>\n<\/li>\n<li>Telephone Numbers (We do not have the telephone number item with the Persons table, because a person could have more than one telephone number. We are assuming that a person has only one cell phone number, only one home telephone number, and only one office telephone number.)<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\" style=\"margin-left: 30.6pt\">Values for the Columns<\/p>\n<\/td>\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">Examples<\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<ul>\n<li>PersonID<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote11anc\" href=\"#sdfootnote11sym\">11<\/a><\/sup><\/li>\n<li>1. Cell<\/li>\n<li>2. Home<\/li>\n<li>3. Office<\/li>\n<li>4. Other<\/li>\n<li>1. Actual cell phone number<\/li>\n<li>2. Actual home phone number<\/li>\n<li>3. Actual office phone number<\/li>\n<li>4. Actual other phone number.<\/li>\n<\/ul>\n<p class=\"import-Normal\">\n<\/td>\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">1 1 0000000000<\/p>\n<p class=\"import-Normal\">1 2 0000000001<\/p>\n<p class=\"import-Normal\">1 3 0000000002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\" style=\"margin-left: 18pt\">Figure 15.54 More details on the example phone table with example entries.<\/p>\n<ul>\n<li>E-Mail Addresses (We do not have the e-mail address item in the Persons table, because a person could have more than one e-mail address. The coding and the columns are similar to the Telephone table.)<\/li>\n<li>PersonID\n<ul>\n<li>1. Personal<\/li>\n<li>2. Office<\/li>\n<li>3. Other<\/li>\n<li>1. Actual personal e-mail address<\/li>\n<li>2. Actual office e-mail address<\/li>\n<li>3. Actual other e-mail address<\/li>\n<\/ul>\n<\/li>\n<li>Addresses (We do not have the address item with the Persons table, because a person could have more than one address. The coding and the columns are similar to the Telephone table.)\n<ul>\n<li>PersonID<\/li>\n<li>1. Current or home<\/li>\n<li>2. Permanent<\/li>\n<li>3. Office<\/li>\n<li>4. Temporary or Vacation or Other<\/li>\n<li>1. Actual Current or Home address.<\/li>\n<li>2. Actual Permanent address<\/li>\n<li>3. Actual Office address<\/li>\n<li>4. Actual Temporary or Vacation or Other<\/li>\n<\/ul>\n<\/li>\n<li>Students (Using the Person ID number, we can pull up the common elements from the Persons table. Using this ID and the program ID in the academic progress table, we can view what courses the student has taken.)\n<ul>\n<li>Person ID<\/li>\n<li>Program ID<\/li>\n<li>First enrollment date<\/li>\n<li>Holds (Yes or No; If \u201cYes,\u201d then the hold table would be used, because a student could have more than one hold active.)<\/li>\n<li>Advisor ID<\/li>\n<\/ul>\n<\/li>\n<li>Holds (The student ID could be repeated if the student has more than one type of hold.)\n<ul>\n<li>Person ID<\/li>\n<li>(financial, academic, etc.)\n<ul>\n<li>1 for academic<\/li>\n<li>2 for financial<\/li>\n<li>3 for moral<\/li>\n<li>4 for whatever<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Instructors (We will track what courses this person has taught in the Schedules table.)\n<ul>\n<li>Person ID<\/li>\n<li>Subject area<\/li>\n<li>Availability<\/li>\n<li>Salary<\/li>\n<\/ul>\n<\/li>\n<li>Leaders (This table with the Persons table would be used to populate the leadership web page. A person could be doing two or more leadership roles. More roles could be added in the future. The deans could be more administrative and advisors could be more academic. Since this is a small institute, the deans could be doing both.)\n<ul>\n<li>Person ID<\/li>\n<li>Position\n<ul>\n<li>1. Director<\/li>\n<li>2. Assistant Director<\/li>\n<li>3. Dean Central<\/li>\n<li>4. Dean Eastern<\/li>\n<li>5. Dean Northern<\/li>\n<li>6. Dean Southern<\/li>\n<li>7. Advisor<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Invoices (From the viewpoint of a student.)\n<ul>\n<li>Person ID<\/li>\n<li>Invoice ID<\/li>\n<li>Purpose\n<ul>\n<li>1. Course fees<\/li>\n<li>2. Lab fees<\/li>\n<li>3. Registration<\/li>\n<\/ul>\n<\/li>\n<li>Amount<\/li>\n<li>Due date<\/li>\n<li>Payment Status\n<ul>\n<li>1. Paid in full<\/li>\n<li>2. Partial payment<\/li>\n<li>3. Overdue<\/li>\n<\/ul>\n<\/li>\n<li>Balance<\/li>\n<li>Last Status date<\/li>\n<li>Payment method\n<ul>\n<li>1. Cash<\/li>\n<li>2. Check<\/li>\n<li>3. Donation<\/li>\n<li>4. Scholarship<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Offered Programs\n<ul>\n<li>ID for each unique offering\n<ul>\n<li>1 Basic Diploma<\/li>\n<li>2 Advanced Diploma<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Program Requirements (This would be a combination of IDs. The first ID is for the program and the second ID is for the course. A third column could be used to reflect when the program requirements were approved. This would handle the situation if a program offering is changed. There would be students on the old program requirements. The student enrollment date would be used to determine which version the student could be using.)\n<ul>\n<li>Program ID<\/li>\n<li>Course ID or course code.<\/li>\n<li>Program approval date<\/li>\n<li>Courses\n<ul>\n<li>Course code (for example: NT1, NT2, BHP, etc.)<\/li>\n<li>Course description<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Schedule (This gives us the ability to schedule a course for a future term and to look at the history of a course. We would also be able to determine which courses were canceled.)\n<ul>\n<li>Schedule ID<\/li>\n<li>Semester (I am assuming this is on a semester scheme instead of a quarter scheme.)\n<ul>\n<li>1. Fall<\/li>\n<li>2. Spring<\/li>\n<li>3. Summer<\/li>\n<\/ul>\n<\/li>\n<li>Year (In four digits. Avoids issues in 2100.)<\/li>\n<li>Course Code<\/li>\n<li>Section Number (If two sessions are never offered in a term for a course, then this field could be dropped.)<\/li>\n<li>Meeting Format\n<ul>\n<li>1. In person<\/li>\n<li>2. Hybrid<\/li>\n<li>3. Virtual<\/li>\n<\/ul>\n<\/li>\n<li>Meeting Location (N\/A or an actual location.)<\/li>\n<li>Meeting Days\n<ul>\n<li>1. Sunday only<\/li>\n<li>2. Monday only<\/li>\n<li>3. Tuesday only<\/li>\n<li>4. Wednesday only<\/li>\n<li>5. Thursday only<\/li>\n<li>6. Friday only<\/li>\n<li>7. Saturday only<\/li>\n<li>8. Monday and Wednesday<\/li>\n<li>9. Tuesday and Thursday<\/li>\n<li>10. To be determined<\/li>\n<\/ul>\n<\/li>\n<li>Meeting Times (This is the start time expressed in a 24-hour clock.<\/li>\n<li>Duration<\/li>\n<li>Instructor ID<\/li>\n<li>Status (Active or Cancelled. With this field, we know whether or not the course ran.)<\/li>\n<li>Do we need to have the actual calendar dates?<\/li>\n<\/ul>\n<\/li>\n<li>Enrollment\n<ul>\n<li>Student ID<\/li>\n<li>Schedule ID (We know when the student was enrolled in a term. This can track when a student has repeated a course.)<\/li>\n<li>Course Code (We know which courses the student took.)<\/li>\n<\/ul>\n<\/li>\n<li>Academic progress (Using the three IDs, we can create an unofficial transcript. For the official transcript, we can add a business rule to keep only the highest grade and ignore a duplicate course with a low grade.)\n<ul>\n<li>Student ID<\/li>\n<li>Program ID<\/li>\n<li>Schedule ID<\/li>\n<li>Course Code<\/li>\n<li>Status (We can pull up the student\u2019s program and see what has been completed<\/li>\n<li>Completed or Needed or must repeat)<\/li>\n<li>Grade<\/li>\n<\/ul>\n<\/li>\n<li>Scholarship\n<ul>\n<li>ID Number<\/li>\n<li>Name of Scholarship<\/li>\n<li>Amount<\/li>\n<li>Deadline Date<\/li>\n<li>Requirements<\/li>\n<li>Point of Contact ID<\/li>\n<\/ul>\n<\/li>\n<li>AwardedScholarship\n<ul>\n<li>\u201cStudent\u201d ID<\/li>\n<li>Scholarship ID<\/li>\n<li>Amount<\/li>\n<li>Other details<\/li>\n<\/ul>\n<\/li>\n<li>Churches (This table will persist even if there is no one in the person table with a relationship to a table.)\n<ul>\n<li>ID<\/li>\n<li>Name<\/li>\n<li>Shorten Name<\/li>\n<li>Address<\/li>\n<li>URL<\/li>\n<li>Pastor ID (this points back to the persons table.)\n<ul>\n<li>Note: The telephone number would be based on the person\u2019s office telephone number.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Education (We can document more than one type.)\n<ul>\n<li>Person ID<\/li>\n<li>1 No award<\/li>\n<li>2 High school or GED<\/li>\n<li>3 Associate\u2019s degree<\/li>\n<li>4 Bachelor\u2019s degree<\/li>\n<li>5 Master\u2019s degree<\/li>\n<li>6 Doctoral or Ph.D. or terminal degree<\/li>\n<li>7 Trade school<\/li>\n<li>8 Basic AIM<\/li>\n<li>Advanced AIM<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"import-Normal\">To add a model, we do a right mouse click on the Models folder. Then we click on Add Class.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image48-2.png\" alt=\"image\" width=\"624px\" height=\"59.9333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.55 Screenshot of adding a model.<\/p>\n<p class=\"import-Normal\">Models use files that have a file extension of \u201c.cs.\u201d<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image49-2.png\" alt=\"image\" width=\"624px\" height=\"432.8px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.56 Screenshot of the generic class.cs floating dialog box.<\/p>\n<p class=\"import-Normal\">We change the generic file name to \u201cAbout.cs\u201d and hit the \u201cAdd\u201d button.<\/p>\n<p class=\"import-Normal\">Figure 15.57 shows the result:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image50-2.png\" alt=\"image\" width=\"467.065196850394px\" height=\"207.028871391076px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.57 Screenshot of the empty About.cs file.<\/p>\n<h3>Adding the Other Web Pages to the Menu<\/h3>\n<p class=\"import-Normal\">You need to use the Views\/Shared\/_Layout.cshtml in order to have the items to appear on the home page.<\/p>\n<p class=\"import-Normal\">Notice in Figure 15.58 how the About asp-action has an entry of \u201cIndex.\u201d This is due to the placement outside of the Home folder. The other folders are inside the Home folder and thus can have unique names.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image51-2.png\" alt=\"image\" width=\"624px\" height=\"213.2px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.58 Text of the menu items.<\/p>\n<p class=\"import-Normal\">Figure 15.59 shows how these appear on the web page. Notice the placement of \u201cAbout\u201d outside of the Home folder does not impact how it appears on the web page.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image52-2.png\" alt=\"image\" width=\"583px\" height=\"637px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.59 View of the menu items (Mobile phone or reduced screen size view).<\/p>\n<table style=\"height: 76px\">\n<tbody>\n<tr class=\"TableGrid-R\" style=\"height: 61px\">\n<td class=\"TableGrid-C\" style=\"border: 0.5pt solid windowtext;height: 61px;width: 975.05px\">\n<p class=\"import-Normal\"><span style=\"color: #ff0000\">The Rick Anderson and Jon P. Smith plus 28 contributors article went into the creation of a database from inside Visual Studio. I had trouble figuring out how to link this program to an existing database. My attempts broken my program. I did not have the time to dig into the solution. So I restarted the effort without using Bootstrap.<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 975.05px\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Second Effort: ASP.NET Core with MVC and EF Core Working with an Existing Database<\/h2>\n<p class=\"import-Normal\">In another chapter, I had worked through the steps of installing Microsoft SQL Server Developer Edition. I used the same steps to install Microsoft SQL Server Express Edition.<\/p>\n<p class=\"import-Normal\">You would select which server you wish to use. See Figure 15.60.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image53-2.png\" alt=\"image\" width=\"624px\" height=\"383.8px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.60 Selecting the desired server from inside Microsoft SQL Server Management Studio<\/p>\n<p class=\"import-Normal\">Inside Visual Studio, you would use \u201cServer Explorer\u201d to link to the desired database server. See Figure 15.61.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image54-2.png\" alt=\"image\" width=\"233.620262467192px\" height=\"322.427926509186px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.61 Visual Studio\u2019s Server Explorer<\/p>\n<p class=\"import-Normal\">You will need an item known as a connection string. To see the text, do a right mouse click on the line containing \u201csqlexpress\u201d and the database name. Select \u201cProperties.\u201d The properties will appear in the lower right hand corner in the \u201cSolution Explorer.\u201d Look for the connection string inside the \u201cConnection\u201d section. See Figure 15.62.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image55-2.png\" alt=\"image\" width=\"276.023937007874px\" height=\"300.826036745407px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.62 Visual Studio\u2019s Properties panel in the Solution Explorer.<\/p>\n<p class=\"import-Normal\">You can copy the connection string. It will have the following appearance:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Data Source=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Trust Server Certificate=True<\/p>\n<p class=\"import-Normal\">I am using insights from the Pranaya Rout article. He does not include Bootstrap. That can be added after things are created.<\/p>\n<p class=\"import-Normal\">Open Visual Studio and select a new project. See Figure 15.9. Select \u201cASP.NET Core Web App (Model-View-Controller).\u201d See Figure 15.12. For the configure project screen, use a different name from the first efforts. For the \u201cAdditional information\u201d screen, we will have the same selections as in Figure 15.14, except we will check the \u201cDo not use top-level statements<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote12anc\" href=\"#sdfootnote12sym\">12<\/a><\/sup>.\u201d<\/p>\n<h3>Adding Microsoft Entity Framework Core Packages<\/h3>\n<p class=\"import-Normal\">As noted in the first effort, Bootstrap is included in the template. We will not repeat that discussion. We do need to add the Entity Framework Core, because it is not part of the .NET Core Framework. This task is accomplished by using the NuGet Package Manager. See Figure 15.63<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image56-2.png\" alt=\"image\" width=\"246.034330708661px\" height=\"420.058582677165px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.63 Accessing the \u201cManage NuGet Packages\u201d option via the right mouse click on the project name.<\/p>\n<p class=\"import-Normal\">Search for \u201cMicrosoft.EntityFrameworkCore.SQLServer.\u201d Select the desired version<sup class=\"import-FootnoteReference\"><a id=\"sdfootnote13anc\" href=\"#sdfootnote13sym\">13<\/a><\/sup>.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image57-2.png\" alt=\"image\" width=\"624px\" height=\"391.4px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.64 The available items that contain \u201cMicrosoft.EntityFrameworkCore\u201d in the title.<\/p>\n<p class=\"import-Normal\">Select and install. See Figure 15.65.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image58-2.png\" alt=\"image\" width=\"530.074015748031px\" height=\"589.082204724409px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.65 The details on the Microsoft.EntityFrameworkCore.SqlServer (Note: The title is truncated in this view.)<\/p>\n<p class=\"import-Normal\">After hitting the \u201cInstall\u201d button, a floating dialog box appear. It has a list of other items that will be installed. Hit the \u201cOK\u201d button. The next floating dialog box is about agreeing to the terms of the license for several items. See Figure 15.66.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image59-2.png\" alt=\"image\" width=\"547px\" height=\"555px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.66 The \u201cLicense Acceptance\u201d floating dialog box.<\/p>\n<p class=\"import-Normal\">Hit the \u201cI Accept\u201d button.<\/p>\n<p class=\"import-Normal\">Repeat these steps and select the Microsoft.EntityFrameworkCore.Tools package.<\/p>\n<p class=\"import-Normal\">The two Microsoft.EntityFrameworkCore packages will appear in the \u201cDependencies\u201d folder. See Figure 15.67.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image60-2.png\" alt=\"image\" width=\"332.028766404199px\" height=\"156.813543307087px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.67 View of the two Microsoft.EntityFrameworkCore packages in the Dependencies folder.<\/p>\n<h3>Creating and Implementing the Database Context<\/h3>\n<p class=\"import-Normal\">The Microsoft.EntityFrameworkCore packages do not have a Visual Designer nor a Wizard. These tools were present in Microsoft.EntityFrameworkCore 6, but not in version 7 or later versions. Instead, we will be doing some <em>reverse engineering,<\/em> which is the act of recovering design information from a source. We will be using the Scaffold-DbContext command, which will examine the connected database and then generate the required context and entities.<\/p>\n<p class=\"import-Normal\">The Scaffold-DbContext command is a resource inside the Package Manager Console. Figure 15.68 shows how to access the Package Manager Console.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image61-2.png\" alt=\"image\" width=\"490.442519685039px\" height=\"198.417217847769px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.68 View of steps for accessing the Package Manager Console.<\/p>\n<p class=\"import-Normal\">The Package Manager Console will appear at the bottom of the workspace. It replaced the \u201cOutput\u201d workspace.<\/p>\n<p class=\"import-Normal\">The Scaffold-DbContext command format is:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Scaffold-Dbcontext &lt;Connection string using \u201cServer\u201d instead of \u201cData Source\u201d and two other changes.&gt; Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models<\/p>\n<p class=\"import-Normal\">For my personal computer, the connection string is:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Data Source=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Encrypt=True;Trust Server Certificate=True<\/p>\n<p class=\"import-Normal\">Scaffold-DbContext command needs the connection string to be modified and to become:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\"><span style=\"background-color: #ffff00\">Server<\/span>=.\\SQLEXPRESS;<span style=\"background-color: #ffff00\">Database<\/span>=ABCOMIM; Trusted_Conection=True;Trust Server Certificate=True<\/p>\n<p class=\"import-Normal\">Here is the full text of the Scaffold-DbContext command:<\/p>\n<p class=\"import-Normal\" style=\"margin-left: 36pt\">Scaffold-Dbcontext \u201cServer=.\\SQLEXPRESS;Initial Catalog=ABCOMIM;Integrated Security=True;Trust Server Certificate=True;\u201d Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models<\/p>\n<p class=\"import-Normal\">The \u201cMicrosoft.EntityFrameworkCore.SqlServer\u201d is based on the database environment. If you were running MySQL or Oracle or another database, then this command would be different.<\/p>\n<p class=\"import-Normal\">The \u201c-OutputDir Models\u201d tells the command where to create the model C# files. Since we have accepted that the Model files make the actual connection to the database, then it follows that the created files should be stored in the Models folder.<\/p>\n<p class=\"import-Normal\">Figure 15.69 shows the command and the output.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image62-2.png\" alt=\"image\" width=\"624px\" height=\"113px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.69 View the Scaffold-DbContext command wording and its output messages.<\/p>\n<h4>The Odd Naming Behavior in the Context.cs File<\/h4>\n<p class=\"import-Normal\">Figure 15.70 shows the created C# files in the Models folder. Notice that the singular spelling is used for each database table. I do not know why Microsoft does not use the actual spelling for the database table names.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image63-2.png\" alt=\"image\" width=\"205.617847769029px\" height=\"308.026666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.70 View of the created C# files in the Models folder.<\/p>\n<p class=\"import-Normal\">The first file (AbcomimContext.cs) did not come from the database. This file was generated by the Scaffold-DbContext command. Notice that Microsoft used \u201cPeople\u201d in the name for the controller (PeopleController). Again, I do not know how the word \u201cPeople\u201d was used instead of \u201cPersons.\u201d In the body of some IActionResult blocks, \u201cPersons\u201d is used. See Figure 15.71 for an extract from this long file.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image64-2.png\" alt=\"image\" width=\"489.642414698163px\" height=\"612.053018372703px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.71 Extract from the ABCOMIM2.Controllers.PeopleController.<\/p>\n<h4>Viewing an Example Model.cs File<\/h4>\n<p class=\"import-Normal\">Look at Figure 15.72. These match the columns in the Persons database table. Notice the usage of the question marks for some of the headers data types and the use of the phrase \u201c= string.Empty.\u201d<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\" style=\"text-align: center\"><strong>The Person Model File Contents<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">namespace ABCOMIM2.Models;<\/p>\n<p class=\"import-Normal\">public partial class Person<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">public int Id { get; set; }<\/p>\n<p class=\"import-Normal\">public string FirstName { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public string MiddleName { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public string LastName { get; set; } = null!;<\/p>\n<p class=\"import-Normal\">public string Suffix { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public string MaidenName { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public string PreferredName { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public string Title { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">public int? HomeChurchId { get; set; }<\/p>\n<p class=\"import-Normal\">public int? NextOfKinId { get; set; }<\/p>\n<p class=\"import-Normal\">public string ActiveRecord { get; set; } = string.Empty;<\/p>\n<p class=\"import-Normal\">}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.72 Extract from the ABCOMIM2.Models.Person file.<\/p>\n<p class=\"import-Normal\">The \u201cstring.Empty\u201d according to Microsoft should accept an absence value. I found that I had to enter something (\u201cN\/A\u201d) for MaidenName and for PreferredName. When a field is not used in the view, then a value is not needed. (You will see this in for the section entitled \u201cConfiguring the View\u201d for the ActiveRecord field.) For the question mark on the header data type, it generated a \u201cNULL\u201d entry. See Figure 15.73.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image65-2.png\" alt=\"image\" width=\"540.046824146982px\" height=\"57.6050393700787px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.73 The stored values from the program to the database.<\/p>\n<h4>The Warning Message in the Context Model CS File<\/h4>\n<p class=\"import-Normal\">In Figure 15.69, there was a warning message. This message was placed toward the end of the ABCOMIM2.Models.AbcomimContext.cs file. See Figure 15.74.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image66-2.png\" alt=\"image\" width=\"624px\" height=\"121.066666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.74 The warning message in the OnConfiguring block (Source of image: https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/)<\/p>\n<p class=\"import-Normal\">In plain English, the warning message is telling us that the connection string is in the Context class. This is a bad programming practice. Good programmers do not hard code certain values. The solution is to put the connection string in a file that should not be available to the visitor. So we will use the appsettings.json file. It is located near the bottom of the Solution Explorer. See Figure 15.75.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image67-2.png\" alt=\"image\" width=\"197.617112860892px\" height=\"198.417217847769px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.75 The location of the appsettings.json file.<\/p>\n<p class=\"import-Normal\">We will edit this file to include the connection string. Notice that we are using the original format instead of the Scaffold-DbContext format. Also notice that we had to add another backward slant bar to the server name field. Figure 15.76 shows the final version of this file.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image68-2.png\" alt=\"image\" width=\"624px\" height=\"203.133333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.76 The revised appsettings.json file.<\/p>\n<p class=\"import-Normal\">The last action is to edit the OnConfiguring block. See Figure 15.77.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image69-2.png\" alt=\"image\" width=\"624px\" height=\"88px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.77 The revised OnConfiguring block.<\/p>\n<h3>Adding the DBContext Service<\/h3>\n<p class=\"import-Normal\">We need to add a new block. See Figure 15.78 for the final version of the Program.cs file.<\/p>\n<table>\n<tbody>\n<tr class=\"TableGrid-R\">\n<td class=\"TableGrid-C\" style=\"border: solid windowtext 0.5pt\">\n<p class=\"import-Normal\">using Microsoft.EntityFrameworkCore;<\/p>\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">using ABCOMIM2.Models;<\/span><\/p>\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">\/\/ This is needed so the program can find AbcomimContext.cs file.<\/span><\/p>\n<p class=\"import-Normal\">namespace ABCOMIM2<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">public class Program<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">public static void Main(string[] args)<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">var builder = WebApplication.CreateBuilder(args);<\/p>\n<p class=\"import-Normal\">\/\/ Add services to the container.<\/p>\n<p class=\"import-Normal\">builder.Services.AddControllersWithViews();<\/p>\n<p class=\"import-Normal\">\/<span style=\"background-color: #ffff00\">\/Adding DBContext Service<\/span><\/p>\n<p class=\"import-Normal\"><span style=\"background-color: #ffff00\">builder.Services.AddDbContext&lt;AbcomimContext&gt;(options =&gt; options.UseSqlServer(builder.Configuration.GetConnectionString(&#8220;DBConnection&#8221;)));<\/span><\/p>\n<p class=\"import-Normal\">var app = builder.Build();<\/p>\n<p class=\"import-Normal\">\/\/ Configure the HTTP request pipeline.<\/p>\n<p class=\"import-Normal\">if (!app.Environment.IsDevelopment())<\/p>\n<p class=\"import-Normal\">{<\/p>\n<p class=\"import-Normal\">app.UseExceptionHandler(&#8220;\/Home\/Error&#8221;);<\/p>\n<p class=\"import-Normal\">\/\/ The default HSTS value is 30 days. You may want to change this for production scenarios, see https:\/\/aka.ms\/aspnetcore-hsts.<\/p>\n<p class=\"import-Normal\">app.UseHsts();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">app.UseHttpsRedirection();<\/p>\n<p class=\"import-Normal\">app.UseStaticFiles();<\/p>\n<p class=\"import-Normal\">app.UseRouting();<\/p>\n<p class=\"import-Normal\">app.UseAuthorization();<\/p>\n<p class=\"import-Normal\">app.MapControllerRoute(<\/p>\n<p class=\"import-Normal\">name: &#8220;default&#8221;,<\/p>\n<p class=\"import-Normal\">pattern: &#8220;{controller=Home}\/{action=Index}\/{id?}&#8221;);<\/p>\n<p class=\"import-Normal\">app.Run();<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">}<\/p>\n<p class=\"import-Normal\">\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"import-Normal\">Figure 15.78 The final version of the Program.cs file.<\/p>\n<h3>Configuring the View<\/h3>\n<p class=\"import-Normal\">So far, we have the models and the views. We need to add a MVC Controller in order to make our program work. To do so, we need to do a right mouse click on the Controllers folder and then select Add =&gt; Controller from the context menu, as shown in Figure 15.79.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image70-2.png\" alt=\"image\" width=\"624px\" height=\"23.0666666666667px\" \/><\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image71-2.png\" alt=\"image\" width=\"624px\" height=\"336.533333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.79 Adding a controller.<\/p>\n<p class=\"import-Normal\">The <strong>Add<\/strong> button will cause the \u201c<strong>Add MVC Controller with views, using Entity Framework<\/strong>\u201d window to appear. From the Model class dropdown, we select the \u201c<strong>Person<\/strong>\u201d model. From the Data context class, we select AbcomimContext. We keep all other selections as they are, i.e., Generate views, Reference script libraries, and Use a layout page options checked. We add \u201cPeopleController\u201d to the Controller Name box. Figure 15.80 shows these actions and Figure 15.81 shows the final appearance.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image72-2.png\" alt=\"image\" width=\"624px\" height=\"435.2px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.80 Working with the \u201cAdd MVC Controller with views, using Entity Framework\u201d options.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image73-2.png\" alt=\"image\" width=\"624px\" height=\"439.8px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.81 Final appearance of the \u201cAdd MVC Controller with views, using Entity Framework\u201d options.<\/p>\n<p class=\"import-Normal\">Click the Add button. A status bar will appear. See Figure 15.82.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image74-2.png\" alt=\"image\" width=\"477.641364829396px\" height=\"132.011443569554px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.82 Scaffolding status bar.<\/p>\n<p class=\"import-Normal\">When the scaffolding is completed, the controller folder will have a new entry. See Figure 15.83.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image75-2.png\" alt=\"image\" width=\"330.428661417323px\" height=\"290.425196850394px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.83 The new PeopleController.<\/p>\n<p class=\"import-Normal\">Also, the View folder has a new addition. See Figure 15.84.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image76-2.png\" alt=\"image\" width=\"173.61501312336px\" height=\"165.6143832021px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.84 The new People view with support five actions.<\/p>\n<p class=\"import-Normal\">When we build the program and navigate to the URL containing \u201c\/People,\u201d the following web page will appear:<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image77-2.png\" alt=\"image\" width=\"624px\" height=\"116.333333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.85 The People web page with the headings from the database table.<\/p>\n<p class=\"import-Normal\">When we hit the create new link, we see the URL has updated. See Figure 15.86.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image78-2.png\" alt=\"image\" width=\"424.836850393701px\" height=\"801.669501312336px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.86 The People\/Create web page (Notice now Active Record field.)<\/p>\n<p class=\"import-Normal\">I added my information. See Figure 15.87.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image79-2.png\" alt=\"image\" width=\"429.637270341207px\" height=\"704.861102362205px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.87 The People\/Create web page with entries.<\/p>\n<p class=\"import-Normal\">Figure 15.88 shows the result of hitting the \u201cCreate\u201d button.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image80.png\" alt=\"image\" width=\"426.436955380577px\" height=\"744.064461942257px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.88 The People\/Create web page with error messages.<\/p>\n<p class=\"import-Normal\">I added \u201cN\/A\u201d in order to clear the error messages. Figure 15.89 shows that the view table was updated with my information.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image81.png\" alt=\"image\" width=\"624px\" height=\"160.733333333333px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.89 The People web page with an entry.<\/p>\n<p class=\"import-Normal\">Notice that three hyperlinks have been added to the end of the row.<\/p>\n<p class=\"import-Normal\">Figure 15.90 shows that the actual database has been revised.<\/p>\n<p class=\"import-Normal\"><img decoding=\"async\" src=\"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-content\/uploads\/sites\/2211\/2025\/01\/image82.png\" alt=\"image\" width=\"624px\" height=\"335.466666666667px\" \/><\/p>\n<p class=\"import-Normal\">Figure 15.90 The revised database table.<\/p>\n<p class=\"import-Normal\">Some sources will state that we have created<em> CRUD<\/em>. This states for Create, Read, Update, and Delete.<\/p>\n<h2>Final Words<\/h2>\n<p class=\"import-Normal\">The first effort had Bootstrap in it. The second effort did not. Why? As you noticed in the <span style=\"color: #ff0000\">red font box<\/span> at the beginning of this chapter, there are many outdated tutorials and forums on the Internet. It is very hard to find clear and current sources of information. Even Microsoft made it hard by providing a tutorial that has Visual Studio creating a database from the lines for creating a website! The Dot Net Tutorials were much better, but some of the articles have misleading titles.<\/p>\n<p class=\"import-Normal\">A complete website project would have stored procedures, images, and more user-friendly information.<\/p>\n<p class=\"import-Normal\">It is my hope that you have gained enough insights from this chapter that you could make good progress with your project.<\/p>\n<p class=\"import-Normal\">Maybe for the fourth edition, this chapter could be revised to include a complete example that uses Bootstrap from start to finish.<\/p>\n<h2>Key Terms<\/h2>\n<p class=\"import-Standard\"><strong>ASP.NET Core<\/strong>: This is an open source and cloud-optimized web framework. This is used for developing modern web applications that can run on Windows, on Linux, and on Mac.<\/p>\n<p class=\"import-Standard\"><strong>controller<\/strong>: This is responsible for working with the model.<\/p>\n<p class=\"import-Standard\"><strong>CRUD<\/strong>: This is an acronym that stands for Create, Read, Update, and Delete.<\/p>\n<p class=\"import-Normal\"><strong>Entity Framework Core<\/strong>: This contains an Object-Relational Mapping (ORM) tool that works with dates by using .NET objects.<\/p>\n<p class=\"import-Standard\"><strong>model<\/strong>: This performs the user\u2019s requested action.<\/p>\n<p class=\"import-Normal\"><strong>M<\/strong><strong>odel-<\/strong><strong>V<\/strong><strong>iew-<\/strong><strong>C<\/strong><strong>ontroller (MVC) framework<\/strong>: This is designed to separate the three parts of a program. This is known as the \u201cseparation of concerns.\u201d The user requests are routed to a controller that is responsible for working with the model. The model performs the user\u2019s requested action. This could be to retrieve the results from a query. The controller chooses the view for displaying the information back to the user. This approach means that the common actions can be used for routing to the user on a web page, to the user on a desktop application, or to the user on a kiosk in a shopping mall. One benefit is that developers can divide the project into different parts.<\/p>\n<p class=\"import-Normal\"><strong>reverse engineering<\/strong><strong>:<\/strong> This is the act of recovering design information from a source. I did not mention in the chapter that software reverse engineering is the process of recovering the design, the requirements specifications, and the functions of a product from analyzing a program\u2019s codes. There are courses and degree programs devoted to this area. A company may reverse engineer a product in order to determine how to build a better version.<\/p>\n<p class=\"import-Normal\"><strong>v<\/strong><strong>iew<\/strong><strong>:<\/strong> This is the presentation to the user.<\/p>\n<h2>Exercises<\/h2>\n<p class=\"import-Standard\">1. Explain the following terms:<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">1. ASP.NET Core<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">2. Model-View-Controller (MVC) framework [CS2023 FPL-Event-Driven and Reactive Programming KA Core 6 and ILO KA Core 4]<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">3. Model<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">4. View<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">5. Controller<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">6. Entity Framework Core<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">7. Reverse engineering<\/p>\n<p class=\"import-Standard\">2. Explain the role or purpose of the following:<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">1. HTML 5<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">2. Bootstrap<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">3. JavaScript<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">4. CSS<\/p>\n<p class=\"import-Standard\" style=\"padding-left: 40px\">[CS2023 SPD Web: Web Platforms KA Core 1]<\/p>\n<p class=\"import-Standard\">3. In the Entity Framework Core is the Object-Relational Mapping (ORM). This was not explained in the chapter. Do some research and explain in your own words what this is about. [CS2023 SPD Web: Web Platforms KA Core 4]<\/p>\n<p class=\"import-Standard\">4. Why do accessibility standards exist? [CS2023 SPD Web: Web Platforms KA Core 4]<\/p>\n<p class=\"import-Standard\">5. Pick a non-profit organization. Examine its website. What is the purpose of the presentation? [CS2023 SPD Web: Web Platforms Non-core 6]<\/p>\n<p class=\"import-Standard\">6. If you are a computing major, chances are you that you may have taken at least one computer programming course. In the final chapters of this textbook, you have worked with HTML 5, with JavaScript, with CSS, with Bootstrap, and with C#. Compare and contrast web programming with general-purpose programming. [CS2023 SPD Web: Web Platforms ILO KA Core 3]<\/p>\n<p class=\"import-Standard\">7. In different places in this textbook, we have talked about style guides, about accessibility, and about security programming. List at least three points how web standards have impacted software development. [CS2023 SPD Web: Web Platforms ILO KA Core 3]<\/p>\n<h3>Advanced questions<\/h3>\n<p class=\"import-Standard\">A1. Show the text from a website project that would execute a query for obtaining data from a connected database. [CS2013 IM Query Languages 5]<\/p>\n<p class=\"import-Standard\">A2. Add to a website project a stored procedure that receives values from the user. [CS2013 IM Query Languages 6]<\/p>\n<h2>A Running Project<\/h2>\n<p class=\"import-Standard\">For your running program, code a website CRUD operation that works with your database.<\/p>\n<h2>Attribution<\/h2>\n<p class=\"import-Standard\">This chapter of Database Design is a brand-new addition.<\/p>\n<p class=\"import-Standard\">This chapter drew from many sources.<\/p>\n<h2>Image Attribution<\/h2>\n<p class=\"import-Standard\">No second edition images were used.<\/p>\n<h2>References<\/h2>\n<p class=\"import-Normal\">Rick Anderson and 23 contributors. \u201cGet started with ASP.NET Core MVC,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId105\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/start-mvc?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/start-mvc?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\n<p class=\"import-Normal\">Rick Anderson and 20 contributors. \u201cPart 2, add a controller to an ASP.NET Core MVC app,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId106\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-controller?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-controller?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\n<p class=\"import-Normal\">Rick Anderson and 23 contributors. \u201cPart 3, add a view to an ASP.NET Core MVC app,\u201d Microsoft Learn, July 29, 2024. <a class=\"rId107\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-view?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-view?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\n<p class=\"import-Normal\">Rick Anderson, Jon P. Smith, and 28 contributors. \u201cPart 4, add a model to an ASP.NET Core MVC app,\u201d July 29, 2024. <a class=\"rId108\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-model?view=aspnetcore-9.0&amp;tabs=visual-studio\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/tutorials\/first-mvc-app\/adding-model?view=aspnetcore-9.0&amp;tabs=visual-studio<\/span><\/a><\/p>\n<p class=\"import-Normal\">Philip Gyllhamn. \u201cHOW TO: Create an WEB API in ASP.NET Core with SQL Database First in Visual Studio 2019,\u201d Medium, May 11. 2019.<\/p>\n<p class=\"import-Normal\">\u201cIntegrating Bootstrap with ASP.NET Core: Step-by-Step Guide,\u201d Web Dev Tutor, September 5, 2023.<\/p>\n<p class=\"import-Normal\">\u201cMVC Framework Introduction,\u201d Geeks for Geeks, July 8, 2024. <a class=\"rId109\" href=\"https:\/\/www.geeksforgeeks.org\/mvc-framework-introduction\/\"><span class=\"import-Hyperlink\">https:\/\/www.geeksforgeeks.org\/mvc-framework-introduction\/<\/span><\/a><\/p>\n<p class=\"import-Normal\">\u201cOverview of ASP.NET Core MVC,\u201d Microsoft Learn, June 17, 2024. <a class=\"rId110\" href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/mvc\/overview?view=aspnetcore-9.0\"><span class=\"import-Hyperlink\">https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/mvc\/overview?view=aspnetcore-9.0<\/span><\/a><\/p>\n<p class=\"import-Normal\">Jan Potgieter. \u201cDevelop a Simple Web Application in ASP.NET with SQL Server,\u201d MSSQL Tips, November 15, 2022. <a class=\"rId111\" href=\"https:\/\/www.mssqltips.com\/sqlservertip\/7461\/developing-a-web-application-with-aspnet-and-sqlserver\/\"><span class=\"import-Hyperlink\">https:\/\/www.mssqltips.com\/sqlservertip\/7461\/developing-a-web-application-with-aspnet-and-sqlserver\/<\/span><\/a><\/p>\n<p class=\"import-Normal\">Pranaya Rout. \u201cASP.NET Core MVC with EF Core DB First Approach,\u201d Don Net Tutorials, n.d. <a class=\"rId112\" href=\"https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/\"><span class=\"import-Hyperlink\">https:\/\/dotnettutorials.net\/lesson\/asp-net-core-mvc-with-ef-core-db-first\/<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<div id=\"sdfootnote1sym\"><a href=\"#sdfootnote1anc\">1<\/a> Long Term Support will receive patches for 36 months. .NET 10 is planned to be released in November 2025.<\/div>\n<div id=\"sdfootnote2sym\"><a href=\"#sdfootnote2anc\">2<\/a> Standard Term Support will receive patches for 18 months.<\/div>\n<div id=\"sdfootnote3sym\"><a href=\"#sdfootnote3anc\">3<\/a> At this writing, the current version is 2022, but 2024 is about to be released.<\/div>\n<div id=\"sdfootnote4sym\"><a href=\"#sdfootnote4anc\">4<\/a> The screenshots will be based on my project for a small religious institution.<\/div>\n<div id=\"sdfootnote5sym\"><a href=\"#sdfootnote5anc\">5<\/a> Some of the tutorials on the Web tend to suggest using .NET 9. It should not matter which version is used.<\/div>\n<div id=\"sdfootnote6sym\"><a href=\"#sdfootnote6anc\">6<\/a> Only one obscure website mentioned this approach: https:\/\/csharp-video-tutorials.blogspot.com\/2019\/03\/install-and-use-bootstrap-in-aspnet-core.html This website did not have a title for this information.<\/div>\n<div id=\"sdfootnote7sym\"><a href=\"#sdfootnote7anc\">7<\/a> While working on this chapter, I was working through the steps from the cited tutorials. I found that I needed to restart the Visual Studio project. The new effort did not have the SSL certificate issue.<\/div>\n<div id=\"sdfootnote8sym\"><a href=\"#sdfootnote8anc\">8<\/a> This came from \u201cHow To Set Up SSL Certificate In Visual Studio and &gt;NET CLI,\u201d CodeMaze, June 7, 2023. https:\/\/code-maze.com\/enable-ssl-certificate-visual-studio-dotnet-cli\/<\/div>\n<div id=\"sdfootnote9sym\"><a href=\"#sdfootnote9anc\">9<\/a>This may appear to be a silly point, but it is not. For those who live in a Linux world, software in the repository lags behind the latest version. One example of this is Apache NetBeans.<\/div>\n<div id=\"sdfootnote10sym\"><a href=\"#sdfootnote10anc\">10<\/a> Recall from another chapter the example of what defines a full-time student or what defines a full teaching load. One institution might define that a full-time student is one who takes 9 credit hours while another institution might define a full-time student as one who takes 12 credit hours.<\/div>\n<div id=\"sdfootnote11sym\"><a href=\"#sdfootnote11anc\">11<\/a> Recall that there are two approaches. One approach is to have an ID number generated for each table. The other approach is to depend upon the combinations of values for defining a unique row. At this writing, I went with the second approach. So the PersonID is a foreign key, but it is a primary key when combined with another column.<\/div>\n<div id=\"sdfootnote12sym\"><a href=\"#sdfootnote12anc\">12<\/a> Java is my favorite programming language. I have come late to the C# party. I have wanted to see the \u201chidden\u201d C# lines so I can gain a better understanding of the coding. Rout and other more experienced C# programmers tend to opt out on seeing these \u201cboilerplate\u201d top-level lines. If you are still learning C#, then you might wish to leave this check box unchecked.<\/div>\n<div id=\"sdfootnote13sym\"><a href=\"#sdfootnote13anc\">13<\/a> You may not be given a choice. So select what is provided.<\/div>\n<\/div>\n","protected":false},"author":2276,"menu_order":15,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["fredstrickland"],"pb_section_license":""},"chapter-type":[],"contributor":[66],"license":[],"class_list":["post-1604","chapter","type-chapter","status-publish","hentry","contributor-fredstrickland"],"part":3,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapters\/1604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/wp\/v2\/users\/2276"}],"version-history":[{"count":3,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapters\/1604\/revisions"}],"predecessor-version":[{"id":1617,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapters\/1604\/revisions\/1617"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapters\/1604\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/wp\/v2\/media?parent=1604"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/pressbooks\/v2\/chapter-type?post=1604"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/wp\/v2\/contributor?post=1604"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/nelson\/wp-json\/wp\/v2\/license?post=1604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}