© Eric Vogel 2021
E. VogelBeginning Entity Framework Core 5https://doi.org/10.1007/978-1-4842-6882-7_17

17. Inserting Data on the Web

Eric Vogel1  
(1)
Okemos, MI, USA
 

In this chapter, I will go over how to insert data in our database using Entity Framework Core 5 and ASP.NET Core Razor Pages. I will cover the generated Create Razor Page from the previous chapter. I will also show how to allow adding an address record.

Generated Create Razor Page

Visual Studio generated the Create.cshtml and Create.cshtml.cs files, which are the view and model, respectively. Let’s now take a look at the generated Create Razor view and model classes. These files allow the user to create a new person record.

Generated View

The generated Create.cshtml Razorview displays ...

Get Beginning Entity Framework Core 5: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.