Lập Trình Web ASP.NET Core MVC - Nhập dữ liệu vào Database

0



Lập Trình Web ASP.NET Core MVC - Nhập dữ liệu vào Database


Project tham khảo:
https://drive.google.com/file/d/10CTfSyr2o21HNt05uFiyE6uZsRlMa1F_/view?usp=sharing


Video hướng dẫn:
https://www.youtube.com/watch?v=5PoHbohBw5Q


Script SQL:

USE [master]
GO
/****** Object:  Database [NhaSachOnline10]    Script Date: 12/13/2023 18:44:33 ******/
CREATE DATABASE [NhaSachOnline10]
 CONTAINMENT = NONE
 ON  PRIMARY
( NAME = N'NhaSachOnline10', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\NhaSachOnline10.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
 LOG ON
( NAME = N'NhaSachOnline10_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\NhaSachOnline10_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
 WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [NhaSachOnline10] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [NhaSachOnline10].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [NhaSachOnline10] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [NhaSachOnline10] SET ANSI_NULLS OFF
GO
ALTER DATABASE [NhaSachOnline10] SET ANSI_PADDING OFF
GO
ALTER DATABASE [NhaSachOnline10] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [NhaSachOnline10] SET ARITHABORT OFF
GO
ALTER DATABASE [NhaSachOnline10] SET AUTO_CLOSE ON
GO
ALTER DATABASE [NhaSachOnline10] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [NhaSachOnline10] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [NhaSachOnline10] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [NhaSachOnline10] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [NhaSachOnline10] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [NhaSachOnline10] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [NhaSachOnline10] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [NhaSachOnline10] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [NhaSachOnline10] SET  ENABLE_BROKER
GO
ALTER DATABASE [NhaSachOnline10] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [NhaSachOnline10] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [NhaSachOnline10] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [NhaSachOnline10] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [NhaSachOnline10] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [NhaSachOnline10] SET READ_COMMITTED_SNAPSHOT ON
GO
ALTER DATABASE [NhaSachOnline10] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [NhaSachOnline10] SET RECOVERY SIMPLE
GO
ALTER DATABASE [NhaSachOnline10] SET  MULTI_USER
GO
ALTER DATABASE [NhaSachOnline10] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [NhaSachOnline10] SET DB_CHAINING OFF
GO
ALTER DATABASE [NhaSachOnline10] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [NhaSachOnline10] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [NhaSachOnline10] SET DELAYED_DURABILITY = DISABLED
GO
ALTER DATABASE [NhaSachOnline10] SET ACCELERATED_DATABASE_RECOVERY = OFF  
GO
ALTER DATABASE [NhaSachOnline10] SET QUERY_STORE = ON
GO
ALTER DATABASE [NhaSachOnline10] SET QUERY_STORE (OPERATION_MODE = READ_WRITE, CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30), DATA_FLUSH_INTERVAL_SECONDS = 900, INTERVAL_LENGTH_MINUTES = 60, MAX_STORAGE_SIZE_MB = 1000, QUERY_CAPTURE_MODE = AUTO, SIZE_BASED_CLEANUP_MODE = AUTO, MAX_PLANS_PER_QUERY = 200, WAIT_STATS_CAPTURE_MODE = ON)
GO
USE [NhaSachOnline10]
GO
/****** Object:  Table [dbo].[__EFMigrationsHistory]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[__EFMigrationsHistory](
    [MigrationId] [nvarchar](150) NOT NULL,
    [ProductVersion] [nvarchar](32) NOT NULL,
 CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY CLUSTERED
(
    [MigrationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetRoleClaims]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetRoleClaims](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [RoleId] [nvarchar](450) NOT NULL,
    [ClaimType] [nvarchar](max) NULL,
    [ClaimValue] [nvarchar](max) NULL,
 CONSTRAINT [PK_AspNetRoleClaims] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetRoles]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetRoles](
    [Id] [nvarchar](450) NOT NULL,
    [Name] [nvarchar](256) NULL,
    [NormalizedName] [nvarchar](256) NULL,
    [ConcurrencyStamp] [nvarchar](max) NULL,
 CONSTRAINT [PK_AspNetRoles] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetUserClaims]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetUserClaims](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [UserId] [nvarchar](450) NOT NULL,
    [ClaimType] [nvarchar](max) NULL,
    [ClaimValue] [nvarchar](max) NULL,
 CONSTRAINT [PK_AspNetUserClaims] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetUserLogins]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetUserLogins](
    [LoginProvider] [nvarchar](450) NOT NULL,
    [ProviderKey] [nvarchar](450) NOT NULL,
    [ProviderDisplayName] [nvarchar](max) NULL,
    [UserId] [nvarchar](450) NOT NULL,
 CONSTRAINT [PK_AspNetUserLogins] PRIMARY KEY CLUSTERED
(
    [LoginProvider] ASC,
    [ProviderKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetUserRoles]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetUserRoles](
    [UserId] [nvarchar](450) NOT NULL,
    [RoleId] [nvarchar](450) NOT NULL,
 CONSTRAINT [PK_AspNetUserRoles] PRIMARY KEY CLUSTERED
(
    [UserId] ASC,
    [RoleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetUsers]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetUsers](
    [Id] [nvarchar](450) NOT NULL,
    [UserName] [nvarchar](256) NULL,
    [NormalizedUserName] [nvarchar](256) NULL,
    [Email] [nvarchar](256) NULL,
    [NormalizedEmail] [nvarchar](256) NULL,
    [EmailConfirmed] [bit] NOT NULL,
    [PasswordHash] [nvarchar](max) NULL,
    [SecurityStamp] [nvarchar](max) NULL,
    [ConcurrencyStamp] [nvarchar](max) NULL,
    [PhoneNumber] [nvarchar](max) NULL,
    [PhoneNumberConfirmed] [bit] NOT NULL,
    [TwoFactorEnabled] [bit] NOT NULL,
    [LockoutEnd] [datetimeoffset](7) NULL,
    [LockoutEnabled] [bit] NOT NULL,
    [AccessFailedCount] [int] NOT NULL,
 CONSTRAINT [PK_AspNetUsers] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AspNetUserTokens]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AspNetUserTokens](
    [UserId] [nvarchar](450) NOT NULL,
    [LoginProvider] [nvarchar](450) NOT NULL,
    [Name] [nvarchar](450) NOT NULL,
    [Value] [nvarchar](max) NULL,
 CONSTRAINT [PK_AspNetUserTokens] PRIMARY KEY CLUSTERED
(
    [UserId] ASC,
    [LoginProvider] ASC,
    [Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChiTietDonHang]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChiTietDonHang](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MaDonHang] [int] NOT NULL,
    [MaSach] [int] NOT NULL,
    [SoLuong] [int] NOT NULL,
    [DonGia] [float] NOT NULL,
    [SachId] [int] NOT NULL,
    [DonHangId] [int] NOT NULL,
 CONSTRAINT [PK_ChiTietDonHang] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChiTietGioHang]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChiTietGioHang](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MaGioHang] [int] NOT NULL,
    [MaSach] [int] NOT NULL,
    [SoLuong] [int] NOT NULL,
    [DonGia] [float] NOT NULL,
    [GioHangId] [int] NOT NULL,
    [SachId] [int] NOT NULL,
 CONSTRAINT [PK_ChiTietGioHang] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DonHang]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DonHang](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MaNguoiDung] [nvarchar](max) NOT NULL,
    [NgayTaoDonHang] [datetime2](7) NOT NULL,
    [MaTrangThaiDonHang] [int] NOT NULL,
    [DaXoa] [bit] NOT NULL,
    [TrangThaiDonHangId] [int] NOT NULL,
 CONSTRAINT [PK_DonHang] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GioHang]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GioHang](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MaNguoiDung] [nvarchar](max) NOT NULL,
    [DaXoa] [bit] NOT NULL,
 CONSTRAINT [PK_GioHang] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sach]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sach](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [TenSach] [nvarchar](100) NULL,
    [TenTacGia] [nvarchar](50) NOT NULL,
    [Gia] [float] NOT NULL,
    [HinhAnh] [nvarchar](max) NULL,
    [TheLoaiId] [int] NOT NULL,
    [MoTa] [nvarchar](max) NULL,
 CONSTRAINT [PK_Sach] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TheLoai]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TheLoai](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [TenTheLoai] [nvarchar](50) NULL,
 CONSTRAINT [PK_TheLoai] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TrangThaiDonHang]    Script Date: 12/13/2023 18:44:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TrangThaiDonHang](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [MaTrangThaiDonHang] [int] NOT NULL,
    [TenTrangThaiDonHang] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_TrangThaiDonHang] PRIMARY KEY CLUSTERED
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'00000000000000_CreateIdentitySchema', N'7.0.9')
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20230824122344_ThemBangDuLieu', N'7.0.9')
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20230923084911_them-ten-tac-gia-vao-bang-sach', N'7.0.9')
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20231212061537_ThemMoTa', N'7.0.9')
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20231213043123_TenSachMaxLength100', N'7.0.9')
INSERT [dbo].[__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20231213080108_XoaMaTheLoaiTrongBangSach', N'7.0.9')
GO
INSERT [dbo].[AspNetRoles] ([Id], [Name], [NormalizedName], [ConcurrencyStamp]) VALUES (N'0d76d49d-82b7-4b81-812f-6b9739d7d5a3', N'User', N'USER', NULL)
INSERT [dbo].[AspNetRoles] ([Id], [Name], [NormalizedName], [ConcurrencyStamp]) VALUES (N'10645778-f2ba-4180-90d6-9402b71e5fde', N'Admin', N'ADMIN', NULL)
GO
INSERT [dbo].[AspNetUserRoles] ([UserId], [RoleId]) VALUES (N'201c1d67-116f-45c9-9695-90d31dba4441', N'10645778-f2ba-4180-90d6-9402b71e5fde')
GO
INSERT [dbo].[AspNetUsers] ([Id], [UserName], [NormalizedUserName], [Email], [NormalizedEmail], [EmailConfirmed], [PasswordHash], [SecurityStamp], [ConcurrencyStamp], [PhoneNumber], [PhoneNumberConfirmed], [TwoFactorEnabled], [LockoutEnd], [LockoutEnabled], [AccessFailedCount]) VALUES (N'201c1d67-116f-45c9-9695-90d31dba4441', N'admin@gmail.com', N'ADMIN@GMAIL.COM', N'admin@gmail.com', N'ADMIN@GMAIL.COM', 1, N'AQAAAAIAAYagAAAAEK80icdUJAHXkiGbIMmRWHhZh75lEermlpffD2Msxpi9BxwT6QJLDq864n8ApuXvsQ==', N'HRNPVNMG7TPD2XX7BTTUQGNQO4Z5WT5T', N'f0aa4379-93e1-4062-8463-13f54a72ea8a', NULL, 0, 0, NULL, 1, 0)
INSERT [dbo].[AspNetUsers] ([Id], [UserName], [NormalizedUserName], [Email], [NormalizedEmail], [EmailConfirmed], [PasswordHash], [SecurityStamp], [ConcurrencyStamp], [PhoneNumber], [PhoneNumberConfirmed], [TwoFactorEnabled], [LockoutEnd], [LockoutEnabled], [AccessFailedCount]) VALUES (N'418f2c0a-b814-44ce-9cf3-497f050c91e6', N'vidu1@gmail.com', N'VIDU1@GMAIL.COM', N'vidu1@gmail.com', N'VIDU1@GMAIL.COM', 1, N'AQAAAAIAAYagAAAAEK43NB7OnrZ7gK1F2W+0K3s0+vZepGucGBhEA7IkjTxFBc5WwF3Cb6AXurR2FMnkOQ==', N'A3LXFQ345MKZ52IX6UIP5DT2YKR4YLH5', N'fe1b6463-d005-4411-8c7c-0131ff93612d', NULL, 0, 0, NULL, 1, 0)
GO
SET IDENTITY_INSERT [dbo].[Sach] ON

INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (5, N'Doctor Who: The Ninth Doctor Vol. 1: Weapons of Past Destruction', N'George Mann', 14.99, N'Doctor Who - The Ninth Doctor Vol. 1 - Weapons of Past Destruction.jpg', 4, N'The Ninth Doctor takes the spotlight for an all-new adventure with fan-favorite Rose Tyler and Captain Jack Harkness! A complete story in this volume!')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (6, N'Doctor Who: The Tenth Doctor 1: Revolutions of Terror', N'Nick Abadzis', 19.99, N'Doctor Who - The Tenth Doctor 1 - Revolutions of Terror.jpg', 4, N'Doctor Who: The Tenth Doctor 1')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (7, N'Doctor Who: The Eleventh Doctor Vol. 1: After Life', N'Al Ewing', 14.15, N'Doctor Who - The Eleventh Doctor Vol. 1 - After Life.jpg', 4, N'With a force of personality capable of bending time itself and all the energy of a star’s exploding heart, the Doctor blasts into the hollow, tragic life of a woman with so much to offer – and gives her the chance to scream “Geronimo!” at the thrills, colours and terrors of an infinite universe!')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (8, N'Doctor Who: The Twelfth Doctor Complete Year One', N'Robbie Morrison, George Mann', 47.19, N'Doctor Who - The Twelfth Doctor Complete Year One.jpg', 4, N'The Twelfth Doctor has just regenerated – but the universe won’t give him a minute’s rest! Not when there’s a violent star on the warpath on a terraformed ice planet – or an ancient alien, masquerading as the celestial Okti, murdering her way towards resurrection in the year 2314!')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (9, N'Doctor Who: Once Upon A Time Lord (BBC Doctor Who)', N'Dan Slott', 17.49, N'Doctor Who - Once Upon A Time Lord (BBC Doctor Who).jpg', 4, N'An epic story that sees companion Martha Jones captured by the insatiable Pyromeths, and her only hope for survival is to keep them distracted with sensational untold tales of the Tenth Doctor facing off against his greatest foes--both classic and new!')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (11, N'Doctor Who: Empire of the Wolf', N'Jody Houser', 17.26, N'Doctor Who - Empire of the Wolf.jpg', 4, N'When searching for his next adventure, the Eighth Doctor meets a strange young woman from another universe… Rose Tyler. He has no idea of the destiny they share, but makes it his mission to discover what brought her here, and how to get her home.')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (12, N'Doctor Who: The Tenth Doctor Vol. 2: The Weeping Angels of Mons', N'Robbie Morrison', 4.87, N'Doctor Who - The Tenth Doctor Vol. 2 - The Weeping Angels of Mons.jpg', 4, N'Second volume of the ongoing Doctor Who: The Tenth Doctor comics series.')
INSERT [dbo].[Sach] ([Id], [TenSach], [TenTacGia], [Gia], [HinhAnh], [TheLoaiId], [MoTa]) VALUES (14, N'Doctor Who Comic Vol. 2: Missy (Doctor Who Comics)', N'Jody Houser', 11.99, N'Doctor Who Comic Vol. 2 - Missy (Doctor Who Comics).jpg', 4, N'Celebrate the 50th Anniversary of the Master with a unique graphic novel starring fan-favorite Missy!')
SET IDENTITY_INSERT [dbo].[Sach] OFF
GO
SET IDENTITY_INSERT [dbo].[TheLoai] ON

INSERT [dbo].[TheLoai] ([Id], [TenTheLoai]) VALUES (1, N'Fantasy')
INSERT [dbo].[TheLoai] ([Id], [TenTheLoai]) VALUES (2, N'Kinh dị')
INSERT [dbo].[TheLoai] ([Id], [TenTheLoai]) VALUES (3, N'Romance')
INSERT [dbo].[TheLoai] ([Id], [TenTheLoai]) VALUES (4, N'Khoa học viễn tưởng')
SET IDENTITY_INSERT [dbo].[TheLoai] OFF
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_AspNetRoleClaims_RoleId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_AspNetRoleClaims_RoleId] ON [dbo].[AspNetRoleClaims]
(
    [RoleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RoleNameIndex]    Script Date: 12/13/2023 18:44:33 ******/
CREATE UNIQUE NONCLUSTERED INDEX [RoleNameIndex] ON [dbo].[AspNetRoles]
(
    [NormalizedName] ASC
)
WHERE ([NormalizedName] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_AspNetUserClaims_UserId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_AspNetUserClaims_UserId] ON [dbo].[AspNetUserClaims]
(
    [UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_AspNetUserLogins_UserId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_AspNetUserLogins_UserId] ON [dbo].[AspNetUserLogins]
(
    [UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_AspNetUserRoles_RoleId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_AspNetUserRoles_RoleId] ON [dbo].[AspNetUserRoles]
(
    [RoleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [EmailIndex]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [EmailIndex] ON [dbo].[AspNetUsers]
(
    [NormalizedEmail] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [UserNameIndex]    Script Date: 12/13/2023 18:44:33 ******/
CREATE UNIQUE NONCLUSTERED INDEX [UserNameIndex] ON [dbo].[AspNetUsers]
(
    [NormalizedUserName] ASC
)
WHERE ([NormalizedUserName] IS NOT NULL)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_ChiTietDonHang_DonHangId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_ChiTietDonHang_DonHangId] ON [dbo].[ChiTietDonHang]
(
    [DonHangId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_ChiTietDonHang_SachId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_ChiTietDonHang_SachId] ON [dbo].[ChiTietDonHang]
(
    [SachId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_ChiTietGioHang_GioHangId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_ChiTietGioHang_GioHangId] ON [dbo].[ChiTietGioHang]
(
    [GioHangId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_ChiTietGioHang_SachId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_ChiTietGioHang_SachId] ON [dbo].[ChiTietGioHang]
(
    [SachId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_DonHang_TrangThaiDonHangId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_DonHang_TrangThaiDonHangId] ON [dbo].[DonHang]
(
    [TrangThaiDonHangId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_Sach_TheLoaiId]    Script Date: 12/13/2023 18:44:33 ******/
CREATE NONCLUSTERED INDEX [IX_Sach_TheLoaiId] ON [dbo].[Sach]
(
    [TheLoaiId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Sach] ADD  DEFAULT (N'') FOR [TenTacGia]
GO
ALTER TABLE [dbo].[AspNetRoleClaims]  WITH CHECK ADD  CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId] FOREIGN KEY([RoleId])
REFERENCES [dbo].[AspNetRoles] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetRoleClaims] CHECK CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId]
GO
ALTER TABLE [dbo].[AspNetUserClaims]  WITH CHECK ADD  CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetUserClaims] CHECK CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId]
GO
ALTER TABLE [dbo].[AspNetUserLogins]  WITH CHECK ADD  CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_UserId] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetUserLogins] CHECK CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_UserId]
GO
ALTER TABLE [dbo].[AspNetUserRoles]  WITH CHECK ADD  CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId] FOREIGN KEY([RoleId])
REFERENCES [dbo].[AspNetRoles] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetUserRoles] CHECK CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId]
GO
ALTER TABLE [dbo].[AspNetUserRoles]  WITH CHECK ADD  CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetUserRoles] CHECK CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId]
GO
ALTER TABLE [dbo].[AspNetUserTokens]  WITH CHECK ADD  CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_UserId] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AspNetUserTokens] CHECK CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_UserId]
GO
ALTER TABLE [dbo].[ChiTietDonHang]  WITH CHECK ADD  CONSTRAINT [FK_ChiTietDonHang_DonHang_DonHangId] FOREIGN KEY([DonHangId])
REFERENCES [dbo].[DonHang] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ChiTietDonHang] CHECK CONSTRAINT [FK_ChiTietDonHang_DonHang_DonHangId]
GO
ALTER TABLE [dbo].[ChiTietDonHang]  WITH CHECK ADD  CONSTRAINT [FK_ChiTietDonHang_Sach_SachId] FOREIGN KEY([SachId])
REFERENCES [dbo].[Sach] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ChiTietDonHang] CHECK CONSTRAINT [FK_ChiTietDonHang_Sach_SachId]
GO
ALTER TABLE [dbo].[ChiTietGioHang]  WITH CHECK ADD  CONSTRAINT [FK_ChiTietGioHang_GioHang_GioHangId] FOREIGN KEY([GioHangId])
REFERENCES [dbo].[GioHang] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ChiTietGioHang] CHECK CONSTRAINT [FK_ChiTietGioHang_GioHang_GioHangId]
GO
ALTER TABLE [dbo].[ChiTietGioHang]  WITH CHECK ADD  CONSTRAINT [FK_ChiTietGioHang_Sach_SachId] FOREIGN KEY([SachId])
REFERENCES [dbo].[Sach] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ChiTietGioHang] CHECK CONSTRAINT [FK_ChiTietGioHang_Sach_SachId]
GO
ALTER TABLE [dbo].[DonHang]  WITH CHECK ADD  CONSTRAINT [FK_DonHang_TrangThaiDonHang_TrangThaiDonHangId] FOREIGN KEY([TrangThaiDonHangId])
REFERENCES [dbo].[TrangThaiDonHang] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DonHang] CHECK CONSTRAINT [FK_DonHang_TrangThaiDonHang_TrangThaiDonHangId]
GO
ALTER TABLE [dbo].[Sach]  WITH CHECK ADD  CONSTRAINT [FK_Sach_TheLoai_TheLoaiId] FOREIGN KEY([TheLoaiId])
REFERENCES [dbo].[TheLoai] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Sach] CHECK CONSTRAINT [FK_Sach_TheLoai_TheLoaiId]
GO
USE [master]
GO
ALTER DATABASE [NhaSachOnline10] SET  READ_WRITE
GO

Tags

Đăng nhận xét

0Nhận xét
Đăng nhận xét (0)