Compare commits
6 Commits
530197cd5c
...
c81946029d
Author | SHA1 | Date | |
---|---|---|---|
c81946029d | |||
c11d13384a | |||
822b5218a4 | |||
ace7c9d1c0 | |||
f2b3b0f4ff | |||
ca3570c197 |
20
SushiBar.sln
20
SushiBar.sln
@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34511.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBar", "SushiBar\SushiBar.csproj", "{68873614-5B4D-4753-B03B-F28E73E17951}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarView", "SushiBarView\SushiBarView.csproj", "{68873614-5B4D-4753-B03B-F28E73E17951}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{4A5A85B2-9B70-4493-B550-0E29FE82E9FD}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDatabaseImplement", "SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{135C846B-59EC-4803-B07C-8991C60C57D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -15,6 +21,18 @@ Global
|
||||
{68873614-5B4D-4753-B03B-F28E73E17951}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68873614-5B4D-4753-B03B-F28E73E17951}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68873614-5B4D-4753-B03B-F28E73E17951}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A5A85B2-9B70-4493-B550-0E29FE82E9FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A5A85B2-9B70-4493-B550-0E29FE82E9FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A5A85B2-9B70-4493-B550-0E29FE82E9FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A5A85B2-9B70-4493-B550-0E29FE82E9FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{135C846B-59EC-4803-B07C-8991C60C57D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{135C846B-59EC-4803-B07C-8991C60C57D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{135C846B-59EC-4803-B07C-8991C60C57D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{135C846B-59EC-4803-B07C-8991C60C57D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25C0DCD8-6A40-42C5-8459-00F6F085A8C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
15
SushiBarContracts/BindingModels/ChequeBindingModel.cs
Normal file
15
SushiBarContracts/BindingModels/ChequeBindingModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class ChequeBindingModel
|
||||
{
|
||||
public List<ChequeItemBindingModel> ChequeItems { get; set; } = new();
|
||||
|
||||
public int? CustomerId { get; set; }
|
||||
|
||||
public DateTime OrderDate { get; set; }
|
||||
|
||||
public double TotalSum { get; set; }
|
||||
|
||||
public int? PromotionId { get; set; }
|
||||
}
|
||||
}
|
11
SushiBarContracts/BindingModels/ChequeItemBindingModel.cs
Normal file
11
SushiBarContracts/BindingModels/ChequeItemBindingModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class ChequeItemBindingModel
|
||||
{
|
||||
public int DishId { get; set; }
|
||||
|
||||
public int CookId { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/BindingModels/CookBindingModel.cs
Normal file
9
SushiBarContracts/BindingModels/CookBindingModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class CookBindingModel
|
||||
{
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
public DateTime EmploymentDate { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/BindingModels/CustomerBindingModel.cs
Normal file
9
SushiBarContracts/BindingModels/CustomerBindingModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class CustomerBindingModel
|
||||
{
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? BirthdayDate { get; set; }
|
||||
}
|
||||
}
|
11
SushiBarContracts/BindingModels/DishBindingModel.cs
Normal file
11
SushiBarContracts/BindingModels/DishBindingModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class DishBindingModel
|
||||
{
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
|
||||
public string Category { get; set;} = string.Empty;
|
||||
|
||||
public List<DishIngredientBindingModel> Ingredients { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class DishIngredientBindingModel
|
||||
{
|
||||
public int IngredientId { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
11
SushiBarContracts/BindingModels/IngredientBindingModel.cs
Normal file
11
SushiBarContracts/BindingModels/IngredientBindingModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class IngredientBindingModel
|
||||
{
|
||||
public string IngredientName { get; set; } = string.Empty;
|
||||
|
||||
public string Unit { get; set; } = string.Empty;
|
||||
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
11
SushiBarContracts/BindingModels/PromotionBindingModel.cs
Normal file
11
SushiBarContracts/BindingModels/PromotionBindingModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarContracts.BindingModels
|
||||
{
|
||||
public class PromotionBindingModel
|
||||
{
|
||||
public string PromotionName { get; set; } = string.Empty;
|
||||
|
||||
public float Discount { get; set; }
|
||||
|
||||
public double TriggeringSum { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/SearchModels/ChequeSearchModel.cs
Normal file
9
SushiBarContracts/SearchModels/ChequeSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class ChequeSearchModel
|
||||
{
|
||||
public int? CustomerId { get; set; }
|
||||
|
||||
public DateTime? OrderDate { get; set; }
|
||||
}
|
||||
}
|
7
SushiBarContracts/SearchModels/CookSearchModel.cs
Normal file
7
SushiBarContracts/SearchModels/CookSearchModel.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class CookSearchModel
|
||||
{
|
||||
public DateTime? EmploymentDate { get; set; }
|
||||
}
|
||||
}
|
7
SushiBarContracts/SearchModels/CustomerSearchModel.cs
Normal file
7
SushiBarContracts/SearchModels/CustomerSearchModel.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class CustomerSearchModel
|
||||
{
|
||||
public double? SumOfAllOrders { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/SearchModels/DishSearchModel.cs
Normal file
9
SushiBarContracts/SearchModels/DishSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class DishSearchModel
|
||||
{
|
||||
public string? DishName { get; set; }
|
||||
|
||||
public string? Category { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/SearchModels/IngredientSearchModel.cs
Normal file
9
SushiBarContracts/SearchModels/IngredientSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class IngredientSearchModel
|
||||
{
|
||||
public string? IngredientName { get; set; }
|
||||
|
||||
public double? Cost { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/SearchModels/PromotionSearchModel.cs
Normal file
9
SushiBarContracts/SearchModels/PromotionSearchModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarContracts.SearchModels
|
||||
{
|
||||
public class PromotionSearchModel
|
||||
{
|
||||
public float? Discount { get; set; }
|
||||
|
||||
public double? TriggeringSum { get; set; }
|
||||
}
|
||||
}
|
9
SushiBarContracts/SushiBarContracts.csproj
Normal file
9
SushiBarContracts/SushiBarContracts.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
22
SushiBarContracts/ViewModels/ChequeItemViewModel.cs
Normal file
22
SushiBarContracts/ViewModels/ChequeItemViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class ChequeItemViewModel
|
||||
{
|
||||
public int CheuqueId { get; set; }
|
||||
|
||||
public int DishId { get; set; }
|
||||
|
||||
[DisplayName("Название блюда")]
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
|
||||
public int CookId { get; set; }
|
||||
|
||||
[DisplayName("Повар")]
|
||||
public string CookFio { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
27
SushiBarContracts/ViewModels/ChequeViewModel.cs
Normal file
27
SushiBarContracts/ViewModels/ChequeViewModel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class ChequeViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? CustomerId { get; set; }
|
||||
|
||||
[DisplayName("Покупатель")]
|
||||
public string? CustomerFio { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, ChequeItemViewModel> ChequeItems { get; set; } = new();
|
||||
|
||||
[DisplayName("Дата заказа")]
|
||||
public DateTime OrderDate { get; set; }
|
||||
|
||||
[DisplayName("Сумма заказа")]
|
||||
public double TotalSum { get; set; }
|
||||
|
||||
public int? PromotionId { get; set; }
|
||||
|
||||
[DisplayName("Скидка")]
|
||||
public float? Discount { get; set; }
|
||||
}
|
||||
}
|
15
SushiBarContracts/ViewModels/CookViewModel.cs
Normal file
15
SushiBarContracts/ViewModels/CookViewModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class CookViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Инициалы повара")]
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата приема на работу")]
|
||||
public DateTime EmploymentDate { get; set; }
|
||||
}
|
||||
}
|
18
SushiBarContracts/ViewModels/CustomerViewModel.cs
Normal file
18
SushiBarContracts/ViewModels/CustomerViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class CustomerViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Инициалы покупателя")]
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата рождения")]
|
||||
public DateTime? BirthdayDate { get; set; }
|
||||
|
||||
[DisplayName("Общая сумма всех заказов")]
|
||||
public double SumOfAllOrders { get; set; }
|
||||
}
|
||||
}
|
17
SushiBarContracts/ViewModels/DishIngredientViewModel.cs
Normal file
17
SushiBarContracts/ViewModels/DishIngredientViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class DishIngredientViewModel
|
||||
{
|
||||
public int DishId { get; set; }
|
||||
|
||||
public int IngredientId { get; set; }
|
||||
|
||||
[DisplayName("Наименование ингредиента")]
|
||||
public string IngredientName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
17
SushiBarContracts/ViewModels/DishViewModel.cs
Normal file
17
SushiBarContracts/ViewModels/DishViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class DishViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название блюда")]
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Категория")]
|
||||
public string Category { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, DishIngredientViewModel> Ingredients { get; set; } = new();
|
||||
}
|
||||
}
|
18
SushiBarContracts/ViewModels/IngredientViewModel.cs
Normal file
18
SushiBarContracts/ViewModels/IngredientViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class IngredientViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Наименование ингредиента")]
|
||||
public string IngredientName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Единицы измерения")]
|
||||
public string Unit { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Стоимость за единицу")]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
18
SushiBarContracts/ViewModels/PromotionViewModel.cs
Normal file
18
SushiBarContracts/ViewModels/PromotionViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class PromotionViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название акции")]
|
||||
public string PromotionName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Размер скидки")]
|
||||
public float Discount { get; set; }
|
||||
|
||||
[DisplayName("Минимальная сумма для применения")]
|
||||
public double TriggeringSum { get; set; }
|
||||
}
|
||||
}
|
7
SushiBarDataModels/IId.cs
Normal file
7
SushiBarDataModels/IId.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace SushiBarDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
13
SushiBarDataModels/Models/ICheque.cs
Normal file
13
SushiBarDataModels/Models/ICheque.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface ICheque : IId
|
||||
{
|
||||
int? CustomerId { get; }
|
||||
|
||||
DateTime OrderDate { get; }
|
||||
|
||||
double TotalSum { get; }
|
||||
|
||||
int? PromotionId { get; }
|
||||
}
|
||||
}
|
13
SushiBarDataModels/Models/IChequeItem.cs
Normal file
13
SushiBarDataModels/Models/IChequeItem.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface IChequeItem : IId
|
||||
{
|
||||
int DishId { get; }
|
||||
|
||||
int ChequeId { get; }
|
||||
|
||||
int CookId { get; }
|
||||
|
||||
int Count { get; }
|
||||
}
|
||||
}
|
9
SushiBarDataModels/Models/ICook.cs
Normal file
9
SushiBarDataModels/Models/ICook.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface ICook : IId
|
||||
{
|
||||
string Fio { get; }
|
||||
|
||||
DateTime EmploymentDate { get; }
|
||||
}
|
||||
}
|
11
SushiBarDataModels/Models/ICustomer.cs
Normal file
11
SushiBarDataModels/Models/ICustomer.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface ICustomer : IId
|
||||
{
|
||||
string Fio { get; }
|
||||
|
||||
DateTime BirthdayDate { get; }
|
||||
|
||||
double SumOfAllOrders { get; }
|
||||
}
|
||||
}
|
9
SushiBarDataModels/Models/IDish.cs
Normal file
9
SushiBarDataModels/Models/IDish.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface IDish : IId
|
||||
{
|
||||
string DishName { get; }
|
||||
|
||||
string Category { get; }
|
||||
}
|
||||
}
|
11
SushiBarDataModels/Models/IDishIngredient.cs
Normal file
11
SushiBarDataModels/Models/IDishIngredient.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface IDishIngredient : IId
|
||||
{
|
||||
int DishId { get; }
|
||||
|
||||
int IngredientId { get; }
|
||||
|
||||
int Count { get; }
|
||||
}
|
||||
}
|
11
SushiBarDataModels/Models/IIngredient.cs
Normal file
11
SushiBarDataModels/Models/IIngredient.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface IIngredient : IId
|
||||
{
|
||||
string IngredientName { get; }
|
||||
|
||||
string Unit { get; }
|
||||
|
||||
double Cost { get; }
|
||||
}
|
||||
}
|
11
SushiBarDataModels/Models/IPromotion.cs
Normal file
11
SushiBarDataModels/Models/IPromotion.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SushiBarDataModels.Models
|
||||
{
|
||||
public interface IPromotion : IId
|
||||
{
|
||||
string PromotionName { get; }
|
||||
|
||||
float Discount { get; }
|
||||
|
||||
double TriggeringSum { get; }
|
||||
}
|
||||
}
|
9
SushiBarDataModels/SushiBarDataModels.csproj
Normal file
9
SushiBarDataModels/SushiBarDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
320
SushiBarDatabaseImplement/Migrations/20240515171525_Initial.Designer.cs
generated
Normal file
320
SushiBarDatabaseImplement/Migrations/20240515171525_Initial.Designer.cs
generated
Normal file
@ -0,0 +1,320 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SushiBarDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SushiBarDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(SushiBarDatabase))]
|
||||
[Migration("20240515171525_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.19")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CustomerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("OrderDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int?>("PromotionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("TotalSum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("PromotionId");
|
||||
|
||||
b.ToTable("Cheques");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ChequeItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ChequeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("CookId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DishId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChequeId");
|
||||
|
||||
b.HasIndex("CookId");
|
||||
|
||||
b.HasIndex("DishId");
|
||||
|
||||
b.ToTable("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cook", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("EmploymentDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cooks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BirthdayDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("SumOfAllOrders")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Dish", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Dishes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.DishIngredient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DishId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("IngredientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DishId");
|
||||
|
||||
b.HasIndex("IngredientId");
|
||||
|
||||
b.ToTable("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("IngredientName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Ingredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Promotion", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<float>("Discount")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("PromotionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("TriggeringSum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Promotions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Customer", "Customer")
|
||||
.WithMany("Cheques")
|
||||
.HasForeignKey("CustomerId");
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Promotion", "Promotion")
|
||||
.WithMany("Cheques")
|
||||
.HasForeignKey("PromotionId");
|
||||
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Promotion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ChequeItem", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Cheque", "Cheque")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("ChequeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Cook", "Cook")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("CookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Dish", "Dish")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("DishId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Cheque");
|
||||
|
||||
b.Navigation("Cook");
|
||||
|
||||
b.Navigation("Dish");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.DishIngredient", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Dish", "Dish")
|
||||
.WithMany("DishIngredients")
|
||||
.HasForeignKey("DishId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Ingredient", "Ingredient")
|
||||
.WithMany("DishIngredients")
|
||||
.HasForeignKey("IngredientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Dish");
|
||||
|
||||
b.Navigation("Ingredient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cook", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Navigation("Cheques");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Dish", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
|
||||
b.Navigation("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b =>
|
||||
{
|
||||
b.Navigation("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Promotion", b =>
|
||||
{
|
||||
b.Navigation("Cheques");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
239
SushiBarDatabaseImplement/Migrations/20240515171525_Initial.cs
Normal file
239
SushiBarDatabaseImplement/Migrations/20240515171525_Initial.cs
Normal file
@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SushiBarDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cooks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Fio = table.Column<string>(type: "text", nullable: false),
|
||||
EmploymentDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cooks", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Customers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Fio = table.Column<string>(type: "text", nullable: false),
|
||||
BirthdayDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
|
||||
SumOfAllOrders = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Customers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Dishes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DishName = table.Column<string>(type: "text", nullable: false),
|
||||
Category = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Dishes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Ingredients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
IngredientName = table.Column<string>(type: "text", nullable: false),
|
||||
Unit = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Ingredients", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Promotions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PromotionName = table.Column<string>(type: "text", nullable: false),
|
||||
Discount = table.Column<float>(type: "real", nullable: false),
|
||||
TriggeringSum = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Promotions", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DishIngredients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DishId = table.Column<int>(type: "integer", nullable: false),
|
||||
IngredientId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DishIngredients", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DishIngredients_Dishes_DishId",
|
||||
column: x => x.DishId,
|
||||
principalTable: "Dishes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DishIngredients_Ingredients_IngredientId",
|
||||
column: x => x.IngredientId,
|
||||
principalTable: "Ingredients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cheques",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CustomerId = table.Column<int>(type: "integer", nullable: true),
|
||||
OrderDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
TotalSum = table.Column<double>(type: "double precision", nullable: false),
|
||||
PromotionId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cheques", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Cheques_Customers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Cheques_Promotions_PromotionId",
|
||||
column: x => x.PromotionId,
|
||||
principalTable: "Promotions",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChequeItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ChequeId = table.Column<int>(type: "integer", nullable: false),
|
||||
DishId = table.Column<int>(type: "integer", nullable: false),
|
||||
CookId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChequeItems", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChequeItems_Cheques_ChequeId",
|
||||
column: x => x.ChequeId,
|
||||
principalTable: "Cheques",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChequeItems_Cooks_CookId",
|
||||
column: x => x.CookId,
|
||||
principalTable: "Cooks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChequeItems_Dishes_DishId",
|
||||
column: x => x.DishId,
|
||||
principalTable: "Dishes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChequeItems_ChequeId",
|
||||
table: "ChequeItems",
|
||||
column: "ChequeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChequeItems_CookId",
|
||||
table: "ChequeItems",
|
||||
column: "CookId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChequeItems_DishId",
|
||||
table: "ChequeItems",
|
||||
column: "DishId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cheques_CustomerId",
|
||||
table: "Cheques",
|
||||
column: "CustomerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cheques_PromotionId",
|
||||
table: "Cheques",
|
||||
column: "PromotionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DishIngredients_DishId",
|
||||
table: "DishIngredients",
|
||||
column: "DishId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DishIngredients_IngredientId",
|
||||
table: "DishIngredients",
|
||||
column: "IngredientId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChequeItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DishIngredients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cheques");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cooks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Dishes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Ingredients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Customers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Promotions");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,317 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SushiBarDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SushiBarDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(SushiBarDatabase))]
|
||||
partial class SushiBarDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.19")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CustomerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("OrderDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int?>("PromotionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("TotalSum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("PromotionId");
|
||||
|
||||
b.ToTable("Cheques");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ChequeItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ChequeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("CookId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DishId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChequeId");
|
||||
|
||||
b.HasIndex("CookId");
|
||||
|
||||
b.HasIndex("DishId");
|
||||
|
||||
b.ToTable("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cook", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("EmploymentDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cooks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BirthdayDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("SumOfAllOrders")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Dish", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DishName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Dishes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.DishIngredient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DishId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("IngredientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DishId");
|
||||
|
||||
b.HasIndex("IngredientId");
|
||||
|
||||
b.ToTable("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("IngredientName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Ingredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Promotion", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<float>("Discount")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("PromotionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("TriggeringSum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Promotions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Customer", "Customer")
|
||||
.WithMany("Cheques")
|
||||
.HasForeignKey("CustomerId");
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Promotion", "Promotion")
|
||||
.WithMany("Cheques")
|
||||
.HasForeignKey("PromotionId");
|
||||
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Promotion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ChequeItem", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Cheque", "Cheque")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("ChequeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Cook", "Cook")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("CookId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Dish", "Dish")
|
||||
.WithMany("ChequeItems")
|
||||
.HasForeignKey("DishId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Cheque");
|
||||
|
||||
b.Navigation("Cook");
|
||||
|
||||
b.Navigation("Dish");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.DishIngredient", b =>
|
||||
{
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Dish", "Dish")
|
||||
.WithMany("DishIngredients")
|
||||
.HasForeignKey("DishId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SushiBarDatabaseImplement.Models.Ingredient", "Ingredient")
|
||||
.WithMany("DishIngredients")
|
||||
.HasForeignKey("IngredientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Dish");
|
||||
|
||||
b.Navigation("Ingredient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cheque", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Cook", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Customer", b =>
|
||||
{
|
||||
b.Navigation("Cheques");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Dish", b =>
|
||||
{
|
||||
b.Navigation("ChequeItems");
|
||||
|
||||
b.Navigation("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b =>
|
||||
{
|
||||
b.Navigation("DishIngredients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Promotion", b =>
|
||||
{
|
||||
b.Navigation("Cheques");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
28
SushiBarDatabaseImplement/Models/Cheque.cs
Normal file
28
SushiBarDatabaseImplement/Models/Cheque.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Cheque
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? CustomerId { get; set; }
|
||||
|
||||
public virtual Customer? Customer { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime OrderDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public double TotalSum { get; set; }
|
||||
|
||||
public int? PromotionId { get; set; }
|
||||
|
||||
public virtual Promotion? Promotion { get; set; }
|
||||
|
||||
[ForeignKey("ChequeId")]
|
||||
public virtual List<ChequeItem> ChequeItems { get; set; } = new();
|
||||
}
|
||||
}
|
28
SushiBarDatabaseImplement/Models/ChequeItem.cs
Normal file
28
SushiBarDatabaseImplement/Models/ChequeItem.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class ChequeItem
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ChequeId { get; set; }
|
||||
|
||||
public virtual Cheque Cheque { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int DishId { get; set; }
|
||||
|
||||
public virtual Dish Dish { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int CookId { get; set; }
|
||||
|
||||
public virtual Cook Cook { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
20
SushiBarDatabaseImplement/Models/Cook.cs
Normal file
20
SushiBarDatabaseImplement/Models/Cook.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Cook
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public DateTime EmploymentDate { get; set; }
|
||||
|
||||
[ForeignKey("CookId")]
|
||||
public virtual List<ChequeItem> ChequeItems { get; set; } = new();
|
||||
}
|
||||
}
|
22
SushiBarDatabaseImplement/Models/Customer.cs
Normal file
22
SushiBarDatabaseImplement/Models/Customer.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Customer
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Fio { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? BirthdayDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public double SumOfAllOrders { get; set; }
|
||||
|
||||
[ForeignKey("CustomerId")]
|
||||
public virtual List<Cheque> Cheques { get; set; } = new();
|
||||
}
|
||||
}
|
23
SushiBarDatabaseImplement/Models/Dish.cs
Normal file
23
SushiBarDatabaseImplement/Models/Dish.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Dish
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Category { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey("DishId")]
|
||||
public virtual List<DishIngredient> DishIngredients { get; set; } = new();
|
||||
|
||||
[ForeignKey("DishId")]
|
||||
public virtual List<ChequeItem> ChequeItems { get; set; } = new();
|
||||
}
|
||||
}
|
23
SushiBarDatabaseImplement/Models/DishIngredient.cs
Normal file
23
SushiBarDatabaseImplement/Models/DishIngredient.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class DishIngredient
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int DishId { get; set; }
|
||||
|
||||
public virtual Dish Dish { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int IngredientId { get; set; }
|
||||
|
||||
public virtual Ingredient Ingredient { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
51
SushiBarDatabaseImplement/Models/Ingredient.cs
Normal file
51
SushiBarDatabaseImplement/Models/Ingredient.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Ingredient
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string IngredientName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Unit { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public double Cost { get; set; }
|
||||
|
||||
[ForeignKey("IngredientId")]
|
||||
public virtual List<DishIngredient> DishIngredients { get; set; } = new();
|
||||
|
||||
public static Ingredient? Create(IngredientBindingModel Model)
|
||||
{
|
||||
return new Ingredient()
|
||||
{
|
||||
IngredientName = Model.IngredientName,
|
||||
name = model.name,
|
||||
facultyid = model.facultyid,
|
||||
};
|
||||
}
|
||||
public void Update(CourseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
name = model.name;
|
||||
facultyid = model.facultyid;
|
||||
}
|
||||
public CourseViewModel ViewModel => new()
|
||||
{
|
||||
course_id = course_id,
|
||||
name = name,
|
||||
facultyid = facultyid,
|
||||
FacultyName = Faculty.name,
|
||||
};
|
||||
}
|
||||
}
|
23
SushiBarDatabaseImplement/Models/Promotion.cs
Normal file
23
SushiBarDatabaseImplement/Models/Promotion.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Models
|
||||
{
|
||||
public class Promotion
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PromotionName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public float Discount { get; set; }
|
||||
|
||||
[Required]
|
||||
public double TriggeringSum { get; set; }
|
||||
|
||||
[ForeignKey("PromotionId")]
|
||||
public virtual List<Cheque> Cheques { get; set; } = new();
|
||||
}
|
||||
}
|
14
SushiBarDatabaseImplement/Storages/IngredientStorage.cs
Normal file
14
SushiBarDatabaseImplement/Storages/IngredientStorage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using SushiBarContracts.ViewModels;
|
||||
|
||||
namespace SushiBarDatabaseImplement.Storages
|
||||
{
|
||||
public class IngredientStorage
|
||||
{
|
||||
public List<IngredientViewModel> GetFullList()
|
||||
{
|
||||
using var Context = new SushiBarDatabase();
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
36
SushiBarDatabaseImplement/SushiBarDatabase.cs
Normal file
36
SushiBarDatabaseImplement/SushiBarDatabase.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SushiBarDatabaseImplement.Models;
|
||||
|
||||
namespace SushiBarDatabaseImplement
|
||||
{
|
||||
public class SushiBarDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
|
||||
{
|
||||
if (OptionsBuilder.IsConfigured == false)
|
||||
{
|
||||
OptionsBuilder.UseNpgsql(@"Host=192.168.56.101;Port=5436;Database=postgres;Username=postgres;Password=admin");
|
||||
}
|
||||
base.OnConfiguring(OptionsBuilder);
|
||||
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDataTimeInfinityConversions", true);
|
||||
}
|
||||
|
||||
public virtual DbSet<Dish> Dishes { get; set; }
|
||||
|
||||
public virtual DbSet<Ingredient> Ingredients { get; set; }
|
||||
|
||||
public virtual DbSet<DishIngredient> DishIngredients { get; set; }
|
||||
|
||||
public virtual DbSet<Cheque> Cheques { get; set; }
|
||||
|
||||
public virtual DbSet<ChequeItem> ChequeItems { get; set; }
|
||||
|
||||
public virtual DbSet<Cook> Cooks { get; set; }
|
||||
|
||||
public virtual DbSet<Customer> Customers { get; set; }
|
||||
|
||||
public virtual DbSet<Promotion> Promotions { get; set; }
|
||||
}
|
||||
}
|
23
SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj
Normal file
23
SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.19" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql" Version="7.0.7" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
22
SushiBarView/SushiBarView.csproj
Normal file
22
SushiBarView/SushiBarView.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user