PIbd-23. Ivanov V.N. Lab Work 03 hard #6
@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PizzeriaListImplement", "Pi
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PizzeriaFileImplement", "PizzeriaFileImplement\PizzeriaFileImplement.csproj", "{4B58D113-7C25-4795-8242-814C8288D30C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PizzeriaDatabaseImplement", "PizzeriaDatabaseImplement\PizzeriaDatabaseImplement.csproj", "{DAE2ED2F-B064-40FA-B594-A360E041B485}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -45,6 +47,10 @@ Global
|
||||
{4B58D113-7C25-4795-8242-814C8288D30C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4B58D113-7C25-4795-8242-814C8288D30C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B58D113-7C25-4795-8242-814C8288D30C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DAE2ED2F-B064-40FA-B594-A360E041B485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DAE2ED2F-B064-40FA-B594-A360E041B485}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAE2ED2F-B064-40FA-B594-A360E041B485}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAE2ED2F-B064-40FA-B594-A360E041B485}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -125,6 +125,17 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
||||
}
|
||||
shop.ShopPizzas.Add(model.PizzaId, (pizza, model.Count));
|
||||
}
|
||||
|
||||
_shopStorage.Update(new ShopBindingModel()
|
||||
{
|
||||
Id = shop.Id,
|
||||
ShopName = shop.ShopName,
|
||||
Adress = shop.Adress,
|
||||
OpeningDate = shop.OpeningDate,
|
||||
ShopPizzas = shop.ShopPizzas,
|
||||
PizzaMaxCount = shop.PizzaMaxCount,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using PizzeriaContracts.StoragesContracts;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDatabaseImplement.Models;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Implements
|
||||
{
|
||||
public class ComponentStorage : IComponentStorage
|
||||
{
|
||||
public List<ComponentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Components.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ComponentName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Components.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.ComponentName) && x.ComponentName == model.ComponentName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Insert(ComponentBindingModel model)
|
||||
{
|
||||
var newComponent = Component.Create(model);
|
||||
if (newComponent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
context.Components.Add(newComponent);
|
||||
context.SaveChanges();
|
||||
return newComponent.GetViewModel;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Update(ComponentBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var component = context.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (component == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
component.Update(model);
|
||||
context.SaveChanges();
|
||||
return component.GetViewModel;
|
||||
}
|
||||
|
||||
public ComponentViewModel? Delete(ComponentBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var element = context.Components.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Components.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using PizzeriaContracts.StoragesContracts;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Implements
|
||||
{
|
||||
public class OrderStorage : IOrderStorage
|
||||
{
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Orders.Include(x => x.Pizza).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Orders.Include(x => x.Pizza).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Orders.Include(x => x.Pizza).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
if (model == null)
|
||||
return null;
|
||||
var newOrder = Order.Create(context, model);
|
||||
if (newOrder == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return newOrder.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (order == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var order = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (order != null)
|
||||
{
|
||||
context.Orders.Remove(order);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using PizzeriaContracts.StoragesContracts;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Implements
|
||||
{
|
||||
public class PizzaStorage : IPizzaStorage
|
||||
{
|
||||
public List<PizzaViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Pizzas.Include(x => x.Components).ThenInclude(x => x.Component).ToList()
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<PizzaViewModel> GetFilteredList(PizzaSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PizzaName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Pizzas.Include(x => x.Components).ThenInclude(x => x.Component)
|
||||
.Where(x => x.PizzaName.Contains(model.PizzaName)).ToList().Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public PizzaViewModel? GetElement(PizzaSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PizzaName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Pizzas.Include(x => x.Components).ThenInclude(x => x.Component)
|
||||
.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.PizzaName) && x.PizzaName == model.PizzaName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public PizzaViewModel? Insert(PizzaBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var newPizza = Pizza.Create(context, model);
|
||||
if (newPizza == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Pizzas.Add(newPizza);
|
||||
context.SaveChanges();
|
||||
return newPizza.GetViewModel;
|
||||
}
|
||||
|
||||
public PizzaViewModel? Update(PizzaBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var Pizza = context.Pizzas.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (Pizza == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Pizza.Update(model);
|
||||
context.SaveChanges();
|
||||
Pizza.UpdateComponents(context, model);
|
||||
transaction.Commit();
|
||||
return Pizza.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PizzaViewModel? Delete(PizzaBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var element = context.Pizzas.Include(x => x.Components).FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Pizzas.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
185
Pizzeria/PizzeriaDatabaseImplement/Implements/ShopStorage.cs
Normal file
185
Pizzeria/PizzeriaDatabaseImplement/Implements/ShopStorage.cs
Normal file
@ -0,0 +1,185 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using PizzeriaContracts.StoragesContracts;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDatabaseImplement.Models;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Implements
|
||||
{
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
public List<ShopViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Shops.Include(x => x.Pizzas).ThenInclude(x => x.Pizza).ToList().
|
||||
Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Shops.Include(x => x.Pizzas).ThenInclude(x => x.Pizza).Where(x => x.ShopName.Contains(model.ShopName)).
|
||||
ToList().Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public ShopViewModel? GetElement(ShopSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new PizzeriaDatabase();
|
||||
return context.Shops.Include(x => x.Pizzas).ThenInclude(x => x.Pizza)
|
||||
.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.ShopName) && x.ShopName == model.ShopName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public ShopViewModel? Insert(ShopBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var newShop = Shop.Create(context, model);
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Shops.Add(newShop);
|
||||
context.SaveChanges();
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public ShopViewModel? Update(ShopBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shop = context.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
shop.Update(model);
|
||||
context.SaveChanges();
|
||||
shop.UpdatePizzas(context, model);
|
||||
transaction.Commit();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ShopViewModel? Delete(ShopBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var shop = context.Shops.Include(x => x.Pizzas).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop != null)
|
||||
{
|
||||
context.Shops.Remove(shop);
|
||||
context.SaveChanges();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool RestockingShops(SupplyBindingModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
var Shops = context.Shops.Include(x => x.Pizzas).ThenInclude(x => x.Pizza).ToList().
|
||||
Where(x => x.PizzaMaxCount > x.ShopPizzas.Select(x => x.Value.Item2).Sum()).ToList();
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
foreach (Shop shop in Shops)
|
||||
{
|
||||
int difference = shop.PizzaMaxCount - shop.ShopPizzas.Select(x => x.Value.Item2).Sum();
|
||||
int refill = Math.Min(difference, model.Count);
|
||||
model.Count -= refill;
|
||||
if (shop.ShopPizzas.ContainsKey(model.PizzaId))
|
||||
{
|
||||
var datePair = shop.ShopPizzas[model.PizzaId];
|
||||
datePair.Item2 += refill;
|
||||
shop.ShopPizzas[model.PizzaId] = datePair;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pizza = context.Pizzas.First(x => x.Id == model.PizzaId);
|
||||
shop.ShopPizzas.Add(model.PizzaId, (pizza, refill));
|
||||
}
|
||||
shop.PizzasDictionatyUpdate(context);
|
||||
if (model.Count == 0)
|
||||
{
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Sale(SupplySearchModel model)
|
||||
{
|
||||
using var context = new PizzeriaDatabase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shops = context.Shops.Include(x => x.Pizzas).ThenInclude(x => x.Pizza).ToList().
|
||||
Where(x => x.ShopPizzas.ContainsKey(model.PizzaId.Value)).OrderByDescending(x => x.ShopPizzas[model.PizzaId.Value].Item2).ToList();
|
||||
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
int residue = model.Count.Value - shop.ShopPizzas[model.PizzaId.Value].Item2;
|
||||
if (residue > 0)
|
||||
{
|
||||
shop.ShopPizzas.Remove(model.PizzaId.Value);
|
||||
shop.PizzasDictionatyUpdate(context);
|
||||
context.SaveChanges();
|
||||
model.Count = residue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (residue == 0)
|
||||
shop.ShopPizzas.Remove(model.PizzaId.Value);
|
||||
else
|
||||
{
|
||||
var dataPair = shop.ShopPizzas[model.PizzaId.Value];
|
||||
dataPair.Item2 = -residue;
|
||||
shop.ShopPizzas[model.PizzaId.Value] = dataPair;
|
||||
}
|
||||
|
||||
shop.PizzasDictionatyUpdate(context);
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
171
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240304162421_InitialCreate.Designer.cs
generated
Normal file
171
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240304162421_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PizzeriaDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PizzeriaDatabase))]
|
||||
[Migration("20240304162421_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PizzaName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Pizzas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("PizzaComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Components",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Cost = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Components", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Pizzas",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PizzaName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Pizzas", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PizzaId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Pizzas_PizzaId",
|
||||
column: x => x.PizzaId,
|
||||
principalTable: "Pizzas",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PizzaComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PizzaId = table.Column<int>(type: "int", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PizzaComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PizzaComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PizzaComponents_Pizzas_PizzaId",
|
||||
column: x => x.PizzaId,
|
||||
principalTable: "Pizzas",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_PizzaId",
|
||||
table: "Orders",
|
||||
column: "PizzaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PizzaComponents_ComponentId",
|
||||
table: "PizzaComponents",
|
||||
column: "ComponentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PizzaComponents_PizzaId",
|
||||
table: "PizzaComponents",
|
||||
column: "PizzaId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PizzaComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Pizzas");
|
||||
}
|
||||
}
|
||||
}
|
248
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240305050232_Hard_init.Designer.cs
generated
Normal file
248
Pizzeria/PizzeriaDatabaseImplement/Migrations/20240305050232_Hard_init.Designer.cs
generated
Normal file
@ -0,0 +1,248 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PizzeriaDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PizzeriaDatabase))]
|
||||
[Migration("20240305050232_Hard_init")]
|
||||
partial class Hard_init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PizzaName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Pizzas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Adress")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("OpeningDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PizzaMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.ShopPizzas", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.ToTable("ShopPizzas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("PizzaComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.ShopPizzas", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("ShopPizzas")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Pizzas")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pizza");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Pizzas");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Hard_init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shops",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
OpeningDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
PizzaMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShopPizzas",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PizzaId = table.Column<int>(type: "int", nullable: false),
|
||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShopPizzas", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopPizzas_Pizzas_PizzaId",
|
||||
column: x => x.PizzaId,
|
||||
principalTable: "Pizzas",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopPizzas_Shops_ShopId",
|
||||
column: x => x.ShopId,
|
||||
principalTable: "Shops",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopPizzas_PizzaId",
|
||||
table: "ShopPizzas",
|
||||
column: "PizzaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopPizzas_ShopId",
|
||||
table: "ShopPizzas",
|
||||
column: "ShopId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShopPizzas");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shops");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,245 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PizzeriaDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PizzeriaDatabase))]
|
||||
partial class PizzeriaDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PizzaName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Pizzas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.ToTable("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Adress")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("OpeningDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PizzaMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.ShopPizzas", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PizzaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PizzaId");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.ToTable("ShopPizzas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.PizzaComponent", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("PizzaComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Pizza");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.ShopPizzas", b =>
|
||||
{
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Pizza", "Pizza")
|
||||
.WithMany("ShopPizzas")
|
||||
.HasForeignKey("PizzaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PizzeriaDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Pizzas")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pizza");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("PizzaComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Pizza", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PizzeriaDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Pizzas");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
60
Pizzeria/PizzeriaDatabaseImplement/Models/Component.cs
Normal file
60
Pizzeria/PizzeriaDatabaseImplement/Models/Component.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using PizzeriaDataModels.Models;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class Component : IComponentModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string ComponentName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public double Cost { get; set; }
|
||||
[ForeignKey("ComponentId")]
|
||||
public virtual List<PizzaComponent> PizzaComponents { get; set; } = new();
|
||||
|
||||
public static Component? Create(ComponentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Component()
|
||||
{
|
||||
Id = model.Id,
|
||||
ComponentName = model.ComponentName,
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
|
||||
public static Component Create(ComponentViewModel model)
|
||||
{
|
||||
return new Component
|
||||
{
|
||||
Id = model.Id,
|
||||
ComponentName = model.ComponentName,
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ComponentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ComponentName = model.ComponentName;
|
||||
Cost = model.Cost;
|
||||
}
|
||||
|
||||
public ComponentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ComponentName = ComponentName,
|
||||
Cost = Cost
|
||||
};
|
||||
}
|
||||
}
|
69
Pizzeria/PizzeriaDatabaseImplement/Models/Order.cs
Normal file
69
Pizzeria/PizzeriaDatabaseImplement/Models/Order.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDataModels.Enums;
|
||||
using PizzeriaDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
[Required]
|
||||
public int PizzaId { get; private set; }
|
||||
|
||||
public virtual Pizza Pizza { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int Count { get; private set; }
|
||||
|
||||
[Required]
|
||||
public double Sum { get; private set; }
|
||||
|
||||
[Required]
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[Required]
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
|
||||
public static Order Create(PizzeriaDatabase context, OrderBindingModel model)
|
||||
{
|
||||
return new Order()
|
||||
{
|
||||
Id = model.Id,
|
||||
PizzaId = model.PizzaId,
|
||||
Pizza = context.Pizzas.First(x => x.Id == model.PizzaId),
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
DateCreate = model.DateCreate,
|
||||
DateImplement = model.DateImplement,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Status = model.Status;
|
||||
DateImplement = model.DateImplement;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
PizzaId = PizzaId,
|
||||
PizzaName = Pizza.PizzaName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
};
|
||||
}
|
||||
}
|
99
Pizzeria/PizzeriaDatabaseImplement/Models/Pizza.cs
Normal file
99
Pizzeria/PizzeriaDatabaseImplement/Models/Pizza.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class Pizza : IPizzaModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string PizzaName { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public double Price { get; set; }
|
||||
|
||||
private Dictionary<int, (IComponentModel, int)>? _pizzaComponents = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IComponentModel, int)> PizzaComponents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_pizzaComponents == null)
|
||||
{
|
||||
_pizzaComponents = Components.ToDictionary(recPC => recPC.ComponentId, recPC =>
|
||||
(recPC.Component as IComponentModel, recPC.Count));
|
||||
}
|
||||
return _pizzaComponents;
|
||||
}
|
||||
}
|
||||
[ForeignKey("PizzaId")]
|
||||
public virtual List<PizzaComponent> Components { get; set; } = new();
|
||||
[ForeignKey("PizzaId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
[ForeignKey("PizzaId")]
|
||||
public virtual List<ShopPizzas> ShopPizzas { get; set; } = new();
|
||||
|
||||
public static Pizza
|
||||
Create(PizzeriaDatabase context, PizzaBindingModel model)
|
||||
{
|
||||
return new Pizza()
|
||||
{
|
||||
Id = model.Id,
|
||||
PizzaName = model.PizzaName,
|
||||
Price = model.Price,
|
||||
Components = model.PizzaComponents.Select(x => new PizzaComponent
|
||||
{
|
||||
Component = context.Components.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(PizzaBindingModel model)
|
||||
{
|
||||
PizzaName = model.PizzaName;
|
||||
Price = model.Price;
|
||||
}
|
||||
|
||||
public PizzaViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
PizzaName = PizzaName,
|
||||
Price = Price,
|
||||
PizzaComponents = PizzaComponents
|
||||
};
|
||||
|
||||
public void UpdateComponents(PizzeriaDatabase context, PizzaBindingModel model)
|
||||
{
|
||||
var pizzaComponents = context.PizzaComponents.Where(rec => rec.PizzaId == model.Id).ToList();
|
||||
|
||||
if (pizzaComponents != null && pizzaComponents.Count > 0)
|
||||
{
|
||||
context.PizzaComponents.RemoveRange(pizzaComponents.Where(rec => !model.PizzaComponents.ContainsKey(rec.ComponentId)));
|
||||
context.SaveChanges();
|
||||
foreach (var updateComponent in pizzaComponents)
|
||||
{
|
||||
updateComponent.Count = model.PizzaComponents[updateComponent.ComponentId].Item2;
|
||||
model.PizzaComponents.Remove(updateComponent.ComponentId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
var pizza = context.Pizzas.First(x => x.Id == Id);
|
||||
foreach (var pc in model.PizzaComponents)
|
||||
{
|
||||
context.PizzaComponents.Add(new PizzaComponent
|
||||
{
|
||||
Pizza = pizza,
|
||||
Component = context.Components.First(x => x.Id == pc.Key),
|
||||
Count = pc.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_pizzaComponents = null;
|
||||
}
|
||||
}
|
||||
}
|
17
Pizzeria/PizzeriaDatabaseImplement/Models/PizzaComponent.cs
Normal file
17
Pizzeria/PizzeriaDatabaseImplement/Models/PizzaComponent.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class PizzaComponent
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int PizzaId { get; set; }
|
||||
[Required]
|
||||
public int ComponentId { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
public virtual Component Component { get; set; } = new();
|
||||
public virtual Pizza Pizza { get; set; } = new();
|
||||
}
|
||||
}
|
114
Pizzeria/PizzeriaDatabaseImplement/Models/Shop.cs
Normal file
114
Pizzeria/PizzeriaDatabaseImplement/Models/Shop.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
public int PizzaMaxCount { get; set; }
|
||||
|
||||
private Dictionary<int, (IPizzaModel, int)>? _shopPizzas = null;
|
||||
|
||||
public Dictionary<int, (IPizzaModel, int)> ShopPizzas
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shopPizzas == null)
|
||||
{
|
||||
if (_shopPizzas == null)
|
||||
{
|
||||
_shopPizzas = Pizzas
|
||||
.ToDictionary(recSP => recSP.PizzaId, recSP => (recSP.Pizza as IPizzaModel, recSP.Count));
|
||||
}
|
||||
return _shopPizzas;
|
||||
}
|
||||
return _shopPizzas;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("ShopId")]
|
||||
public List<ShopPizzas> Pizzas { get; set; } = new();
|
||||
|
||||
public static Shop Create(PizzeriaDatabase context, ShopBindingModel model)
|
||||
{
|
||||
return new Shop()
|
||||
{
|
||||
Id = model.Id,
|
||||
ShopName = model.ShopName,
|
||||
Adress = model.Adress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
Pizzas = model.ShopPizzas.Select(x => new ShopPizzas
|
||||
{
|
||||
Pizza = context.Pizzas.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList(),
|
||||
PizzaMaxCount = model.PizzaMaxCount
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ShopBindingModel model)
|
||||
{
|
||||
ShopName = model.ShopName;
|
||||
Adress = model.Adress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
PizzaMaxCount = model.PizzaMaxCount;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ShopName = ShopName,
|
||||
Adress = Adress,
|
||||
OpeningDate = OpeningDate,
|
||||
ShopPizzas = ShopPizzas,
|
||||
PizzaMaxCount = PizzaMaxCount
|
||||
};
|
||||
|
||||
public void UpdatePizzas(PizzeriaDatabase context, ShopBindingModel model)
|
||||
{
|
||||
var ShopPizzas = context.ShopPizzas.Where(rec => rec.ShopId == model.Id).ToList();
|
||||
if (ShopPizzas != null && ShopPizzas.Count > 0)
|
||||
{
|
||||
context.ShopPizzas.RemoveRange(ShopPizzas.Where(rec => !model.ShopPizzas.ContainsKey(rec.PizzaId)));
|
||||
context.SaveChanges();
|
||||
ShopPizzas = context.ShopPizzas.Where(rec => rec.ShopId == model.Id).ToList();
|
||||
foreach (var updatePizza in ShopPizzas)
|
||||
{
|
||||
updatePizza.Count = model.ShopPizzas[updatePizza.PizzaId].Item2;
|
||||
model.ShopPizzas.Remove(updatePizza.PizzaId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var shop = context.Shops.First(x => x.Id == Id);
|
||||
foreach (var ar in model.ShopPizzas)
|
||||
{
|
||||
context.ShopPizzas.Add(new ShopPizzas
|
||||
{
|
||||
Shop = shop,
|
||||
Pizza = context.Pizzas.First(x => x.Id == ar.Key),
|
||||
Count = ar.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_shopPizzas = null;
|
||||
}
|
||||
|
||||
public void PizzasDictionatyUpdate(PizzeriaDatabase context)
|
||||
{
|
||||
UpdatePizzas(context, new ShopBindingModel
|
||||
{
|
||||
Id = Id,
|
||||
ShopPizzas = ShopPizzas,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
22
Pizzeria/PizzeriaDatabaseImplement/Models/ShopPizzas.cs
Normal file
22
Pizzeria/PizzeriaDatabaseImplement/Models/ShopPizzas.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
public class ShopPizzas
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int PizzaId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ShopId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
public virtual Shop Shop { get; set; } = new();
|
||||
|
||||
public virtual Pizza Pizza { get; set; } = new();
|
||||
}
|
||||
}
|
24
Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabase.cs
Normal file
24
Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabase.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using PizzeriaDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PizzeriaDatabaseImplement
|
||||
{
|
||||
public class PizzeriaDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-M2G96S06\SQLEXPRESS;Initial Catalog=PizzeriaDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Component> Components { get; set; }
|
||||
public virtual DbSet<Pizza> Pizzas { get; set; }
|
||||
public virtual DbSet<PizzaComponent> PizzaComponents { get; set; }
|
||||
public virtual DbSet<Order> Orders { get; set; }
|
||||
public virtual DbSet<Shop> Shops { get; set; }
|
||||
public virtual DbSet<ShopPizzas> ShopPizzas { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" />
|
||||
<ProjectReference Include="..\PizzeriaDataModels\PizzeriaDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -19,6 +19,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
@ -28,6 +32,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PizzeriaBusinessLogic\PizzeriaBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\PizzeriaContracts\PizzeriaContracts.csproj" />
|
||||
<ProjectReference Include="..\PizzeriaDatabaseImplement\PizzeriaDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\PizzeriaFileImplement\PizzeriaFileImplement.csproj" />
|
||||
<ProjectReference Include="..\PizzeriaListImplement\PizzeriaListImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -4,7 +4,7 @@ using NLog.Extensions.Logging;
|
||||
using PizzeriaBusinessLogic.BusinessLogics;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.StoragesContracts;
|
||||
using PizzeriaFileImplement.Implements;
|
||||
using PizzeriaDatabaseImplement.Implements;
|
||||
using PizzeriaView;
|
||||
|
||||
namespace Pizzeria
|
||||
|
Loading…
Reference in New Issue
Block a user