diff --git a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/OrderLogic.cs b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/OrderLogic.cs
index 9b4e906..865608c 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/OrderLogic.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/OrderLogic.cs
@@ -3,6 +3,7 @@ using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.StorageContracts;
using ComputerHardwareStoreContracts.ViewModels;
+using ComputerHardwareStoreDataModels.Enums;
using Microsoft.Extensions.Logging;
namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
@@ -78,7 +79,6 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
model.OrderProduct = element.OrderProduct;
model.DateCreate = element.DateCreate;
model.Status = element.Status;
- model.Cost = element.Cost;
if (model.Status != orderStatus - 1)
{
@@ -106,9 +106,9 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
- if (model.Cost <= 0)
+ if (model.Sum <= 0)
{
- throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Cost));
+ throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
}
}
}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/PurchaseLogic.cs b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/PurchaseLogic.cs
index ce693a0..81b183f 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/PurchaseLogic.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/BusinessLogic/PurchaseLogic.cs
@@ -92,7 +92,7 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
- if (string.IsNullOrEmpty(model.DateCreate))
+ if (model.DateCreate == null) // TODO чего блин, всмысле нет
{
throw new ArgumentNullException("Нет даты создания покупки", nameof(model.Date));
}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/ComputerHardwareStoreBusinessLogic.csproj b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/ComputerHardwareStoreBusinessLogic.csproj
index 47a15a0..982ae40 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/ComputerHardwareStoreBusinessLogic.csproj
+++ b/ComputerHardwareStore/ComputerHardwareStoreBusinessLogic/ComputerHardwareStoreBusinessLogic.csproj
@@ -6,6 +6,12 @@
enable
+
+
+
+
+
+
diff --git a/ComputerHardwareStore/ComputerHardwareStoreContracts/BindingModels/OrderBindingModel.cs b/ComputerHardwareStore/ComputerHardwareStoreContracts/BindingModels/OrderBindingModel.cs
index 720bc7b..9cf80bd 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreContracts/BindingModels/OrderBindingModel.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreContracts/BindingModels/OrderBindingModel.cs
@@ -6,12 +6,10 @@ namespace ComputerHardwareStoreContracts.BindingModels
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
- public int CannedId { get; set; }
- public int Count { get; set; }
- public double Cost { get; set; }
+ public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
- public DateTime? DateImplement { get; set; }
+ public DateTime? DateImplement { get; set; } = null;
public Dictionary OrderProduct { get; set; } = new();
}
}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuidStorage.cs b/ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuildStorage.cs
similarity index 94%
rename from ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuidStorage.cs
rename to ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuildStorage.cs
index fba13ee..a389993 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuidStorage.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreContracts/StorageContracts/IBuildStorage.cs
@@ -4,7 +4,7 @@ using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.StorageContracts
{
- public interface IBuidStorage
+ public interface IBuildStorage
{
List GetFullList();
List GetFilteredList(BuildSearchModel model);
diff --git a/ComputerHardwareStore/ComputerHardwareStoreContracts/ViewModels/OrderViewModel.cs b/ComputerHardwareStore/ComputerHardwareStoreContracts/ViewModels/OrderViewModel.cs
index 02394a4..d2f0ff1 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreContracts/ViewModels/OrderViewModel.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreContracts/ViewModels/OrderViewModel.cs
@@ -1,15 +1,21 @@
-using ComputerHardwareStoreDataModels.Models;
+using ComputerHardwareStoreDataModels.Enums;
+using ComputerHardwareStoreDataModels.Models;
using System.ComponentModel;
namespace ComputerHardwareStoreContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
+ [DisplayName("Номер")]
public int Id { get; set; }
- [DisplayName("Стоимость")]
- public double Cost { get; set; }
+ [DisplayName("Сумма")]
+ public double Sum { get; set; }
+ [DisplayName("Статус")]
+ public OrderStatus Status { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
+ [DisplayName("Дата выполнения")]
+ public DateTime? DateImplement { get; set; }
public Dictionary OrderProduct { get; set; } = new();
}
}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreDataModels/Models/IOrderModel.cs b/ComputerHardwareStore/ComputerHardwareStoreDataModels/Models/IOrderModel.cs
index bddb1f6..06f933b 100644
--- a/ComputerHardwareStore/ComputerHardwareStoreDataModels/Models/IOrderModel.cs
+++ b/ComputerHardwareStore/ComputerHardwareStoreDataModels/Models/IOrderModel.cs
@@ -1,9 +1,13 @@
-namespace ComputerHardwareStoreDataModels.Models
+using ComputerHardwareStoreDataModels.Enums;
+
+namespace ComputerHardwareStoreDataModels.Models
{
public interface IOrderModel : IId
{
- double Cost { get; }
+ double Sum { get; }
+ OrderStatus Status { get; }
DateTime DateCreate { get; }
+ DateTime? DateImplement { get; }
public Dictionary OrderProduct { get; }
}
}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDBContext.cs b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDBContext.cs
new file mode 100644
index 0000000..9226f42
--- /dev/null
+++ b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDBContext.cs
@@ -0,0 +1,35 @@
+using ComputerHardwareStoreDatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace ComputerHardwareStoreDatabaseImplement
+{
+ public class ComputerHardwareStoreDBContext : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (optionsBuilder.IsConfigured == false)
+ {
+ //optionsBuilder.UseNpgsql(@"Host=localhost;Database=ProductBar_db;Username=postgres;Password=postgres"); // не надо >:
+ /*
+ * в program добавить:
+ * // получаем строку подключения из файла конфигурации
+ * string connection = builder.Configuration.GetConnectionString("DefaultConnection");
+ *
+ * // добавляем контекст ApplicationContext в качестве сервиса в приложение
+ * builder.Services.AddDbContext(options => options.UseSqlServer(connection));
+ *
+ * в appsettings:
+ * "ConnectionStrings": {
+ * "DefaultConnection": "Host=localhost;Database=ProductBar_db;Username=compstore;Password=compstore"
+ * },
+ */
+ }
+ base.OnConfiguring(optionsBuilder);
+ AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
+ AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
+ }
+ public virtual DbSet Components { set; get; }
+ public virtual DbSet Products { set; get; }
+ public virtual DbSet ProductComponents { set; get; }
+ }
+}
diff --git a/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDatabaseImplement.csproj b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDatabaseImplement.csproj
new file mode 100644
index 0000000..a7da7e9
--- /dev/null
+++ b/ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/ComputerHardwareStoreDatabaseImplement.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+