From db546557fad2ee358db277b89496637c5c14bc8a Mon Sep 17 00:00:00 2001 From: s459315 Date: Sat, 23 Jul 2022 23:57:12 +0200 Subject: [PATCH] Added Relations and changed name of Database --- RMData/RMData.refactorlog | 7 +++++++ RMData/dbo/Tables/Inventory.sql | 3 ++- RMData/dbo/Tables/Sale.sql | 3 ++- RMData/dbo/Tables/SaleDetail.sql | 3 ++- RMDataManager/Models/IdentityModels.cs | 2 +- RMDataManager/Web.config | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/RMData/RMData.refactorlog b/RMData/RMData.refactorlog index 174f553..b10dc38 100644 --- a/RMData/RMData.refactorlog +++ b/RMData/RMData.refactorlog @@ -63,4 +63,11 @@ + + + + + + + \ No newline at end of file diff --git a/RMData/dbo/Tables/Inventory.sql b/RMData/dbo/Tables/Inventory.sql index 12346cb..ee4a29f 100644 --- a/RMData/dbo/Tables/Inventory.sql +++ b/RMData/dbo/Tables/Inventory.sql @@ -4,5 +4,6 @@ [ProductId] INT NOT NULL, [Quantity] INT NOT NULL DEFAULT 1, [PurchasePrice] MONEY NOT NULL, - [PurchaseDate] DATETIME2 NOT NULL DEFAULT getutcdate(), + [PurchaseDate] DATETIME2 NOT NULL DEFAULT getutcdate(), + CONSTRAINT [FK_Inventory_ToProduct] FOREIGN KEY (ProductId) REFERENCES Product(Id) ) diff --git a/RMData/dbo/Tables/Sale.sql b/RMData/dbo/Tables/Sale.sql index ea3545d..c408e93 100644 --- a/RMData/dbo/Tables/Sale.sql +++ b/RMData/dbo/Tables/Sale.sql @@ -5,5 +5,6 @@ [SaleDate] DATETIME2 NOT NULL, [SubTotal] MONEY NOT NULL, [Tax] MONEY NOT NULL, - [Total] MONEY NOT NULL + [Total] MONEY NOT NULL, + CONSTRAINT [FK_Sale_ToUser] FOREIGN KEY (CashierId) REFERENCES [User](Id) ) diff --git a/RMData/dbo/Tables/SaleDetail.sql b/RMData/dbo/Tables/SaleDetail.sql index cbf738f..41c071c 100644 --- a/RMData/dbo/Tables/SaleDetail.sql +++ b/RMData/dbo/Tables/SaleDetail.sql @@ -6,5 +6,6 @@ [Quantity] INT NOT NULL DEFAULT 1, [PurchasePrice] MONEY NOT NULL, [Tax] MONEY NOT NULL DEFAULT 0, - + CONSTRAINT [FK_SaleDetail_ToSale] FOREIGN KEY (SaleId) REFERENCES Sale(Id), + CONSTRAINT [FK_SaleDetail_ToProduct] FOREIGN KEY (ProductId) REFERENCES Product(Id) ) diff --git a/RMDataManager/Models/IdentityModels.cs b/RMDataManager/Models/IdentityModels.cs index 2089e6f..e679725 100644 --- a/RMDataManager/Models/IdentityModels.cs +++ b/RMDataManager/Models/IdentityModels.cs @@ -21,7 +21,7 @@ namespace RMDataManager.Models public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext() - : base("DefaultConnection", throwIfV1Schema: false) + : base("EFData", throwIfV1Schema: false) { } diff --git a/RMDataManager/Web.config b/RMDataManager/Web.config index 9529ec5..120ea28 100644 --- a/RMDataManager/Web.config +++ b/RMDataManager/Web.config @@ -9,7 +9,7 @@
- +