https://github.com/walidabazo/asp.net-core-8-razor-pages-crud---.net-8-razor-pages-crud-using-entity-framework-core-and-sql-server
ASP.NET Core 8 Razor Pages CRUD - .NET 8 Razor Pages CRUD Using Entity Framework Core and SQL Server
https://github.com/walidabazo/asp.net-core-8-razor-pages-crud---.net-8-razor-pages-crud-using-entity-framework-core-and-sql-server
asp-net-core crud-application entity-framework-core mssqlserver razor-pages
Last synced: about 1 month ago
JSON representation
ASP.NET Core 8 Razor Pages CRUD - .NET 8 Razor Pages CRUD Using Entity Framework Core and SQL Server
- Host: GitHub
- URL: https://github.com/walidabazo/asp.net-core-8-razor-pages-crud---.net-8-razor-pages-crud-using-entity-framework-core-and-sql-server
- Owner: walidabazo
- Created: 2024-01-06T15:03:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-29T18:47:42.000Z (over 1 year ago)
- Last Synced: 2025-02-02T07:41:23.613Z (8 months ago)
- Topics: asp-net-core, crud-application, entity-framework-core, mssqlserver, razor-pages
- Language: HTML
- Homepage:
- Size: 29.3 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ASP.NET Core 8 Razor Pages CRUD - .NET 8 Razor Pages CRUD Using Entity Framework Core and SQL Server
In this video, we are going to create an ASP.NET Razor Pages CRUD app using Entity Framework Core and SQL Server. We will use the .NET 8 Razor Pages template in Visual Studio 2022 to create this CRUD app.
[](https://youtu.be/UqegTYn2aKE)
## Introduction
## Create Project
## Create Database MS SQL Server
## Asp.NET Core Connection Db MS SQL Server
## Install Nugets ASP.NET Core ( Entity Framework )
## Create Application Db Context Class
## Register Database Connections
## Create Product Model ASP.NET Core
## Add-Migrations ASP.NET Core
## Update-Database (Create Tables) Asp.Net Core
## Create Administration
## List Products
## Create ProductDto Model
## Create the Form Asp.Net Core
## Form Validation Asp.Net Core
Name
## Upload Image on Server
string newFilename = DateTime.Now.ToString("yyyyMMddHHmmssfff");
newFilename += Path.GetExtension(ProductDto.ImageFileName!.FileName);
string ImageFullPath = environment.WebRootPath + "/Images/" + newFilename;
using (var stream = System.IO.File.Create(ImageFullPath))
{
ProductDto.ImageFileName.CopyTo(stream);
}
## Delete Image on Server//Delete Old Image on the server
string OldimageFullPath = environment.WebRootPath + "/images/" + product.ImageFileName;
System.IO.File.Delete(OldimageFullPath);
## Save On Database
product.Name = ProductDto.Name;
product.Brand = ProductDto.Brand;
product.Category = ProductDto.Category;
product.Price = ProductDto.Price;
product.Description = ProductDto.Description ?? "";
product.ImageFileName = newFileName;context.SaveChanges();
Product = product;
successMessage = "Product Updated";
## Pagination(Page Size) ASP.NET Core
## Search ASP.NET Core
## Sporting ASP.NET Corewe are going to create an ASP.NET Razor Pages Full CRUD Operations application using Entity Framework Core Code First approach and SQL Server.
We will be using the Core .NET 8 Razor Pages template in Visual Studio 2022 to create this application.
Bootstrap in this ASP.NET Razor Pages website to style our pages.