Pay&Report fix
This commit is contained in:
parent
5c574a0dec
commit
aa1e2bf2e4
@ -71,11 +71,8 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Сумма оплаты должна быть больше 0", nameof(model.SumPayment));
|
throw new ArgumentNullException("Сумма оплаты должна быть больше 0", nameof(model.SumPayment));
|
||||||
}
|
}
|
||||||
if (model.PayProductList.Count == 0) {
|
|
||||||
throw new ArgumentNullException("нельзя оплатить пустой заказ", nameof(model.PayProductList));
|
|
||||||
}
|
|
||||||
_logger.LogInformation($"Payment. ID:{model.ID}.Sum:{model.SumPayment}.OrderID:{model.OrderID}" +
|
_logger.LogInformation($"Payment. ID:{model.ID}.Sum:{model.SumPayment}.OrderID:{model.OrderID}" +
|
||||||
$".PayOption{model.PayOption}.Products:{model.PayProductList}");
|
$".PayOption{model.PayOption}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetFullPayment(PaymeantBindingModel model) {
|
public bool SetFullPayment(PaymeantBindingModel model) {
|
||||||
|
@ -43,8 +43,12 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
List<ReportProductsViewModel>? products = new();
|
List<ReportProductsViewModel>? products = new();
|
||||||
|
|
||||||
|
|
||||||
foreach (var paymeant in paymeants) {
|
foreach (var paymeant in paymeants) {
|
||||||
foreach (var product in paymeant.PayProductList) {
|
var order = _orderStorage.GetElement(new OrderSearchModel { ID = paymeant.OrderID })
|
||||||
|
?? throw new Exception("Ошибка полуения данных");
|
||||||
|
|
||||||
|
foreach (var product in order.ProductList) {
|
||||||
products.Add(new ReportProductsViewModel {
|
products.Add(new ReportProductsViewModel {
|
||||||
ID = product.Value.Item1.ID,
|
ID = product.Value.Item1.ID,
|
||||||
ProductName = product.Value.Item1.ProductName,
|
ProductName = product.Value.Item1.ProductName,
|
||||||
@ -76,7 +80,6 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
// Получение списка товаров с указанием, в какие оплаты товар входит
|
// Получение списка товаров с указанием, в какие оплаты товар входит
|
||||||
public List<ReportPaymeantProductsViewModel> GetPaymeantProducts(int _clientID) {
|
public List<ReportPaymeantProductsViewModel> GetPaymeantProducts(int _clientID) {
|
||||||
var products = _productstorage.GetFullList();
|
|
||||||
var paymeants = _paymeantstorage.GetFillteredList(new PaymeantSearchModel { ClientID = _clientID });
|
var paymeants = _paymeantstorage.GetFillteredList(new PaymeantSearchModel { ClientID = _clientID });
|
||||||
|
|
||||||
var list = new List<ReportPaymeantProductsViewModel>();
|
var list = new List<ReportPaymeantProductsViewModel>();
|
||||||
@ -88,9 +91,14 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var product in paymeant.PayProductList) {
|
foreach (var payment in paymeants) {
|
||||||
record.Products.Add(new(product.Value.Item1.ProductName, product.Value.Item2));
|
var order = _orderStorage.GetElement(new OrderSearchModel { ID = paymeant.OrderID })
|
||||||
record.TotalCount += product.Value.Item2;
|
?? throw new Exception("Ошибка полуения данных");
|
||||||
|
|
||||||
|
foreach (var product in order.ProductList) {
|
||||||
|
record.Products.Add(new(product.Value.Item1.ProductName, product.Value.Item2));
|
||||||
|
record.TotalCount += product.Value.Item2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
|
@ -19,5 +19,7 @@ namespace ElectronicsShopContracts.BindingModels
|
|||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
|
|
||||||
public Dictionary<int, (IProductModel, int)> ProductList { get; set; } = new();
|
public Dictionary<int, (IProductModel, int)> ProductList { get; set; } = new();
|
||||||
|
|
||||||
|
public OrderStatus Status { get; set; } = OrderStatus.Неоплачено;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,5 @@ namespace ElectronicsShopContracts.BindingModels
|
|||||||
public int ClientID { get; set; }
|
public int ClientID { get; set; }
|
||||||
|
|
||||||
public DateTime DatePaymeant { get; set; } = DateTime.Now;
|
public DateTime DatePaymeant { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
public Dictionary<int, (IProductModel, int)> PayProductList { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,5 +23,6 @@ namespace ElectronicsShopContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Список товаров")]
|
[DisplayName("Список товаров")]
|
||||||
public Dictionary<int, (IProductModel, int)> ProductList { get; set; } = new();
|
public Dictionary<int, (IProductModel, int)> ProductList { get; set; } = new();
|
||||||
|
public OrderStatus Status { get; set; } = OrderStatus.Неоплачено;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,5 @@ namespace ElectronicsShopContracts.ViewModels
|
|||||||
public int ClientID { get; set; }
|
public int ClientID { get; set; }
|
||||||
|
|
||||||
public DateTime DatePaymeant { get; set; }
|
public DateTime DatePaymeant { get; set; }
|
||||||
|
|
||||||
[DisplayName("Список оплаченных товаров")]
|
|
||||||
public Dictionary<int, (IProductModel, int)> PayProductList { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using ElectronicsShopContracts.SearchModels;
|
|||||||
using ElectronicsShopContracts.StorageContracts;
|
using ElectronicsShopContracts.StorageContracts;
|
||||||
using ElectronicsShopContracts.ViewModels;
|
using ElectronicsShopContracts.ViewModels;
|
||||||
using ElectronicsShopDataBaseImplement.Models;
|
using ElectronicsShopDataBaseImplement.Models;
|
||||||
|
using ElectronicsShopDataModels.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
@ -96,14 +97,14 @@ namespace ElectronicsShopDataBaseImplement.Implements
|
|||||||
else if (model.ClientID.HasValue) {
|
else if (model.ClientID.HasValue) {
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include (x => x.Products)
|
.Include (x => x.Products)
|
||||||
.Where(x => x.ClientID == model.ClientID)
|
.Where(x => x.ClientID == model.ClientID && x.Status == OrderStatus.Неоплачено)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Products)
|
.Include(x => x.Products)
|
||||||
.ThenInclude(x => x._product)
|
.ThenInclude(x => x._product)
|
||||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.Status == OrderStatus.Неоплачено)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -1,324 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ElectronicsShopDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(Database))]
|
|
||||||
[Migration("20240605160339_InitMigration")]
|
|
||||||
partial class InitMigration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostNum")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.MessageInfo", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("MessageID")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Body")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateDelivery")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Subject")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("MessageID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Messages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DatePaymeant")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PayOption")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int?>("PaymentID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("PaymentID");
|
|
||||||
|
|
||||||
b.ToTable("Paymeants");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("CostItemID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("EmployeeID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.MessageInfo", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ClientID");
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
|
|
||||||
.WithMany("Payments")
|
|
||||||
.HasForeignKey("PaymentID");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CostItemID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("CostItem");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Payments");
|
|
||||||
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,310 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ElectronicsShopDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(Database))]
|
|
||||||
[Migration("20240724032333_Migration02")]
|
|
||||||
partial class Migration02
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostNum")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.MessageInfo", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("MessageID")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Body")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateDelivery")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Subject")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("MessageID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Messages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DatePaymeant")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PayOption")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Paymeants");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("CostItemID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("EmployeeID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.MessageInfo", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ClientID");
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CostItemID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("CostItem");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Migration02 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,271 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ElectronicsShopDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(Database))]
|
|
||||||
[Migration("20240724033824_Migration03")]
|
|
||||||
partial class Migration03
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostNum")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DatePaymeant")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PayOption")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Paymeants");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("CostItemID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("EmployeeID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CostItemID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("CostItem");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Migration03 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Messages");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Messages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MessageID = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ClientID = table.Column<int>(type: "int", nullable: true),
|
|
||||||
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Messages", x => x.MessageID);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Messages_Clients_ClientID",
|
|
||||||
column: x => x.ClientID,
|
|
||||||
principalTable: "Clients",
|
|
||||||
principalColumn: "ID");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Messages_ClientID",
|
|
||||||
table: "Messages",
|
|
||||||
column: "ClientID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class _05 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,284 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ElectronicsShopDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(Database))]
|
|
||||||
[Migration("20240724093852_Migration06")]
|
|
||||||
partial class Migration06
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostNum")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DatePaymeant")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PayOption")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.ToTable("Paymeants");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("CostItemID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("EmployeeID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
|
|
||||||
.WithMany("Payments")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CostItemID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("CostItem");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Payments");
|
|
||||||
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Migration06 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_OrderID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "OrderID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_OrderID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "OrderID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_OrderID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_OrderID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,285 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ElectronicsShopDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(Database))]
|
|
||||||
[Migration("20240724094839_Migration07")]
|
|
||||||
partial class Migration07
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostNum")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("ClientID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderID");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DatePaymeant")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("OrderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PayOption")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int?>("PaymentID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("SumPayment")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("PaymentID");
|
|
||||||
|
|
||||||
b.ToTable("Paymeants");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.HasIndex("CostItemID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Employee", "Employee")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("EmployeeID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ClientID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("OrderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
|
|
||||||
.WithMany("Payments")
|
|
||||||
.HasForeignKey("PaymentID");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.CostItem", "CostItem")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CostItemID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("CostItem");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Payments");
|
|
||||||
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Migration07 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_OrderID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_OrderID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "PaymentID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_Paymeants_PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PaymentID",
|
|
||||||
table: "Paymeants");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Paymeants_OrderID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "OrderID");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Paymeants_Orders_OrderID",
|
|
||||||
table: "Paymeants",
|
|
||||||
column: "OrderID",
|
|
||||||
principalTable: "Orders",
|
|
||||||
principalColumn: "ID",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(Database))]
|
[DbContext(typeof(Database))]
|
||||||
[Migration("20240724085609_05")]
|
[Migration("20240726071024_InitMigration")]
|
||||||
partial class _05
|
partial class InitMigration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -117,6 +117,9 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
b.Property<double>("Sum")
|
||||||
.HasColumnType("float");
|
.HasColumnType("float");
|
||||||
|
|
@ -41,27 +41,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
table.PrimaryKey("PK_Employees", x => x.ID);
|
table.PrimaryKey("PK_Employees", x => x.ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Messages",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
MessageID = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
||||||
ClientID = table.Column<int>(type: "int", nullable: true),
|
|
||||||
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
||||||
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Messages", x => x.MessageID);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Messages_Clients_ClientID",
|
|
||||||
column: x => x.ClientID,
|
|
||||||
principalTable: "Clients",
|
|
||||||
principalColumn: "ID");
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Orders",
|
name: "Orders",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -70,7 +49,8 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Sum = table.Column<double>(type: "float", nullable: false),
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
ClientID = table.Column<int>(type: "int", nullable: false),
|
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -181,11 +161,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
table: "CostItems",
|
table: "CostItems",
|
||||||
column: "EmployeeID");
|
column: "EmployeeID");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Messages_ClientID",
|
|
||||||
table: "Messages",
|
|
||||||
column: "ClientID");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_OrderProducts_OrderID",
|
name: "IX_OrderProducts_OrderID",
|
||||||
table: "OrderProducts",
|
table: "OrderProducts",
|
||||||
@ -215,9 +190,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Messages");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "OrderProducts");
|
name: "OrderProducts");
|
||||||
|
|
@ -114,6 +114,9 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
b.Property<double>("Sum")
|
||||||
.HasColumnType("float");
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
@ -27,7 +27,10 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
public Dictionary<int, (IProductModel, int)>? _productList = null;
|
[Required]
|
||||||
|
public OrderStatus Status { get; set; } = OrderStatus.Неоплачено;
|
||||||
|
|
||||||
|
public Dictionary<int, (IProductModel, int)>? _productList = null;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IProductModel, int)> ProductList
|
public Dictionary<int, (IProductModel, int)> ProductList
|
||||||
@ -62,7 +65,8 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
{
|
{
|
||||||
_product = context.Products.First(y => y.ID == x.Key),
|
_product = context.Products.First(y => y.ID == x.Key),
|
||||||
Count = x.Value.Item2
|
Count = x.Value.Item2
|
||||||
}).ToList()
|
}).ToList(),
|
||||||
|
Status = model.Status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +77,15 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
ProductList = ProductList,
|
ProductList = ProductList,
|
||||||
|
Status = Status,
|
||||||
};
|
};
|
||||||
|
|
||||||
public void Update(OrderBindingModel model) {
|
public void Update(OrderBindingModel model) {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Sum = model.Sum;
|
Sum = model.Sum;
|
||||||
|
Status = model.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProducts(Database context,OrderBindingModel model) {
|
public void UpdateProducts(Database context,OrderBindingModel model) {
|
||||||
|
@ -31,9 +31,6 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
|
|
||||||
public DateTime DatePaymeant { get; set; }
|
public DateTime DatePaymeant { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
public Dictionary<int, (IProductModel, int)> PayProductList { get; set; } = new();
|
|
||||||
|
|
||||||
public static Paymeant? Create(PaymeantBindingModel? model)
|
public static Paymeant? Create(PaymeantBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -48,7 +45,6 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
PayOption = model.PayOption,
|
PayOption = model.PayOption,
|
||||||
ClientID = model.ClientID,
|
ClientID = model.ClientID,
|
||||||
DatePaymeant = model.DatePaymeant,
|
DatePaymeant = model.DatePaymeant,
|
||||||
PayProductList = model.PayProductList
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(PaymeantBindingModel? model)
|
public void Update(PaymeantBindingModel? model)
|
||||||
@ -68,7 +64,6 @@ namespace ElectronicsShopDataBaseImplement.Models
|
|||||||
PayOption = PayOption,
|
PayOption = PayOption,
|
||||||
ClientID = ClientID,
|
ClientID = ClientID,
|
||||||
DatePaymeant = DatePaymeant,
|
DatePaymeant = DatePaymeant,
|
||||||
PayProductList = PayProductList
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronicsShopDataModels.Enums {
|
||||||
|
public enum OrderStatus {
|
||||||
|
Оплачено = 0,
|
||||||
|
|
||||||
|
Неоплачено = -1
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ namespace ElectronicsShopDataModels.Models
|
|||||||
int ClientID { get; }
|
int ClientID { get; }
|
||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
double Sum { get; }
|
double Sum { get; }
|
||||||
|
OrderStatus Status { get; }
|
||||||
|
|
||||||
//список товаров в заказе
|
//список товаров в заказе
|
||||||
Dictionary<int, (IProductModel, int)> ProductList { get; }
|
Dictionary<int, (IProductModel, int)> ProductList { get; }
|
||||||
|
@ -15,8 +15,5 @@ namespace ElectronicsShopDataModels.Models
|
|||||||
PaymeantOption PayOption { get; }
|
PaymeantOption PayOption { get; }
|
||||||
DateTime DatePaymeant { get; }
|
DateTime DatePaymeant { get; }
|
||||||
int ClientID { get; }
|
int ClientID { get; }
|
||||||
|
|
||||||
// Список оплаченнх товаров
|
|
||||||
Dictionary<int, (IProductModel, int)> PayProductList { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||||
|
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
using ElectronicsShopBusinessLogic.BusinessLogic;
|
using ElectronicsShopBusinessLogic.BusinessLogic;
|
||||||
using ElectronicsShopBusinessLogic.MailWorker;
|
using ElectronicsShopBusinessLogic.MailWorker;
|
||||||
@ -7,6 +8,7 @@ using ElectronicsShopContracts.BusinessLogicContracts;
|
|||||||
using ElectronicsShopContracts.SearchModels;
|
using ElectronicsShopContracts.SearchModels;
|
||||||
using ElectronicsShopContracts.ViewModels;
|
using ElectronicsShopContracts.ViewModels;
|
||||||
using ElectronicsShopDataBaseImplement.Models;
|
using ElectronicsShopDataBaseImplement.Models;
|
||||||
|
using ElectronicsShopDataModels.Enums;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.Identity.Client;
|
using Microsoft.Identity.Client;
|
||||||
@ -101,7 +103,6 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
PayOption = payemeant.PayOption,
|
PayOption = payemeant.PayOption,
|
||||||
ClientID = payemeant.ClientID,
|
ClientID = payemeant.ClientID,
|
||||||
DatePaymeant = payemeant.DatePaymeant,
|
DatePaymeant = payemeant.DatePaymeant,
|
||||||
PayProductList = payemeant.PayProductList,
|
|
||||||
}, model.PayOption);
|
}, model.PayOption);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -111,12 +112,24 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
throw new Exception("Ошибка получения данных");
|
throw new Exception("Ошибка получения данных");
|
||||||
}
|
}
|
||||||
|
|
||||||
model.PayProductList = products;
|
|
||||||
_payLogic.CreatePay(model);
|
_payLogic.CreatePay(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.PayOption == 0) {
|
if (model.PayOption == 0) {
|
||||||
_orderLogic.Delete(new OrderBindingModel { ID = model.OrderID });
|
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
||||||
|
|
||||||
|
if (order == null) {
|
||||||
|
throw new Exception("Ошибка получения данных");
|
||||||
|
}
|
||||||
|
|
||||||
|
_orderLogic.Update(new OrderBindingModel {
|
||||||
|
ID = model.OrderID,
|
||||||
|
ClientID = order.ClientID,
|
||||||
|
DateCreate = order.DateCreate,
|
||||||
|
Sum = order.Sum - model.SumPayment,
|
||||||
|
ProductList = order.ProductList,
|
||||||
|
Status = OrderStatus.Оплачено
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
var order = _orderLogic.ReadElement(new OrderSearchModel { ID = model.OrderID });
|
||||||
|
@ -177,7 +177,8 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
ClientID = view.ClientID,
|
ClientID = view.ClientID,
|
||||||
DateCreate = view.DateCreate,
|
DateCreate = view.DateCreate,
|
||||||
ProductList = _productlist ?? new Dictionary<int, (IProductModel, int)>(),
|
ProductList = _productlist ?? new Dictionary<int, (IProductModel, int)>(),
|
||||||
Sum = Calc(_productlist ?? new Dictionary<int, (IProductModel, int)>())
|
Sum = Calc(_productlist ?? new Dictionary<int, (IProductModel, int)>()),
|
||||||
|
Status = view.Status,
|
||||||
};
|
};
|
||||||
var operationResult = _order.Update(model);
|
var operationResult = _order.Update(model);
|
||||||
if (!operationResult) {
|
if (!operationResult) {
|
||||||
|
Binary file not shown.
@ -122,6 +122,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
APIClient.PostRequest("api/main/createorder", new OrderBindingModel {
|
APIClient.PostRequest("api/main/createorder", new OrderBindingModel {
|
||||||
ClientID = APIClient.Client.ID,
|
ClientID = APIClient.Client.ID,
|
||||||
DateCreate = DateTime.Now,
|
DateCreate = DateTime.Now,
|
||||||
|
Status = OrderStatus.Íĺîďëŕ÷ĺíî
|
||||||
});
|
});
|
||||||
return RedirectToAction("OrderView");
|
return RedirectToAction("OrderView");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user