Skip to main content

Posts

Showing posts with the label Razor Pages

.NET6 Razor Pages CRUD Operations With Entity Framework Core

In this article, we will do a small demo of the AspNetCore 6 Razor Pages CRUD operation. Razor Pages: Razor Page is a simplified web application model. On comparing with the 'MVC' template, razor pages won't have 'Controller', which means Razor Page is a combination of 'View' and 'Model'. Routing itself is configured within the page or view. A Razor Page mostly contains 2 files like '*.cshtml'(View) and '*.cshtml.cs'(model). Create A .NET6 Razor Pages Application: Let's create a .Net6 Razor Page sample application to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using the .NET CLI command) editor. CLI command dotnet new webapp -o Your_Project_Name Let's explore the project to understand its structure: (1) Let's understand the initial services registered in 'Progr

.NET5 Razor Pages CRUD Operations Using Entity Frame Work Core

In this article, we will implement a sample application .Net5 Razor Pages CRUD operations using entity framework core. Razor Pages: Razor Page is a simplified web application model. On comparing with 'MVC' template, razor pages won't have 'Controller', which means razor pages is a combination of 'Views' and 'Models'. Routing itself configured within the page or view. A razor page mostly contains 2 files like 'filename.cshtml'(view) and 'filename.cshtml.cs'(model). Create A .Net5 Razor Page Application: Begin our journey by creating a .Net5 razor page template application. Visual Studio users it is very easy to create razor applications by selecting the template option like 'ASP.NET Core Web APP'. Here I'm using a visual studio code editor and .Net CLI commands to generate the application. CLI Command To Create Razor Page Application: dotnet new webapp -n your_project_name After creating the project few basic things we