Book Image

ASP.NET Core 2 Fundamentals

By : Onur Gumus, Mugilan T. S. Ragupathi
Book Image

ASP.NET Core 2 Fundamentals

By: Onur Gumus, Mugilan T. S. Ragupathi

Overview of this book

The book sets the stage with an introduction to web applications and helps you build an understanding of the tried-and-true MVC architecture. You learn all about views, from what is the Razor view engine to tagging helpers. You gain insight into what models are, how to bind them, and how to migrate database using the correct model. As you get comfortable with the world of ASP.NET, you learn about validation and routing. You also learn the advanced concepts, such as designing Rest Buy (a RESTful shopping cart application), creating entities for it, and creating EF context and migrations. By the time you are done reading the book, you will be able to optimally use ASP.NET to develop, unit test, and deploy applications like a pro.
Table of Contents (14 chapters)

Introduction to Models


Models are simple POCO (Plain Old C# Objects) classes representing your business domain data. They basically model real-world entities. We can consider them as code reflections of real-world concepts and entities. For an e-commerce business, model classes would be Product, Order, and Inventory. If you are building an application for a university, model classes would be Student, Teacher, and Subject. Models represent the business domain data in your application and they are not aware of the underlying database that is being used in your application. In fact, you don't even need a database to work with models.

Creating an ASP.NET Core Application

Here are the steps to create an ASP.NET Core application:

  1. Make sure to create an ASP.NET Core application with an empty template.
  2. Create a Controllers folder and create a HomeController with a single Index action method.
  3. Create the following folder/files for the ViewModel:
    • Views: This folder is inside your project.
    • Views\_ViewStart...