Creating the Tic-Tac-Toe home page

Since the basic project structure is now in place, we need to implement the different components that need to work together to provide the Tic-Tac-Toe game web application:

  1. Update the Program.cs and Startup.cs files, as explained previously.
  1. Add a new controller, right-click within Solution Explorer on the Controllers folder, and then select Add | Controller...:

  1. In the Add Scaffold pop-up window, choose MVC Controller - Empty, and name your new controller HomeController:

  1. Your MVC home controller gets autogenerated, containing a single method. You now need to add a corresponding view by right-clicking on the Index method name and selecting Add View... from the menu:

  1. The Add View window helps to define what needs to be generated. Leave the default empty template and enable the usage of the layout page we are going to modify in the next section of this chapter:

  1. Congratulations! Your view gets autogenerated and you can test your application by pressing F5, or by clicking Debug on the Visual Studio 2019 menu and then Start Debugging. We will finalize the view later in this chapter by adding more relevant content to it.

The preceding view generated appears as plain as it could possibly be, and may not provide the best of user experiences on our web application. To help with making sure that we create more meaningful content, and systematically so, we will be using layout pages and NPM to pull in packages that will help advance the look and feel of applications that we build with ASP.NET Core 3. Let's look at how we can do that in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.190.175