diff --git a/ProjectWorkshop/ProjectWorkshop/Entities/Product.cs b/ProjectWorkshop/ProjectWorkshop/Entities/Product.cs index 38e90ad..6002222 100644 --- a/ProjectWorkshop/ProjectWorkshop/Entities/Product.cs +++ b/ProjectWorkshop/ProjectWorkshop/Entities/Product.cs @@ -10,11 +10,8 @@ public class Product public double Price { get; private set; } - public DateTime AssemblyDate { get; private set; } - public ProductType ProductType { get; private set; } - public static Product CreateEntity(int id, string productName, double price, ProductType productType) { return new Product @@ -22,8 +19,7 @@ public class Product ID = id, ProductName = productName ?? string.Empty, Price = price, - ProductType = productType, - AssemblyDate = DateTime.Now + ProductType = productType }; } } diff --git a/ProjectWorkshop/ProjectWorkshop/Repositories/Implementations/ProductRepository.cs b/ProjectWorkshop/ProjectWorkshop/Repositories/Implementations/ProductRepository.cs index c8f7af1..40a0942 100644 --- a/ProjectWorkshop/ProjectWorkshop/Repositories/Implementations/ProductRepository.cs +++ b/ProjectWorkshop/ProjectWorkshop/Repositories/Implementations/ProductRepository.cs @@ -30,8 +30,8 @@ public class ProductRepository : IProductRepository { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryInsert = @" - INSERT INTO Product (ProductName, Price, AssemblyDate, ProductType) - VALUES (@ProductName, @Price, @AssemblyDate, @ProductType) + INSERT INTO Product (ProductName, Price, ProductType) + VALUES (@ProductName, @Price, @ProductType) RETURNING ID"; connection.Execute(queryInsert, product); } @@ -50,7 +50,7 @@ public class ProductRepository : IProductRepository using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryUpdate = @" UPDATE Product - SET ProductName=@ProductName, Price=@Price, AssemblyDate=@AssemblyDate, ProductType=@ProductType + SET ProductName=@ProductName, Price=@Price, ProductType=@ProductType WHERE ID=@ID"; connection.Execute(queryUpdate, product); }