Compare commits
44 Commits
19d3158342
...
BACKDEV-40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a3392e800 | ||
|
|
dadaf9c744 | ||
|
|
311b70d3be | ||
|
|
0cf11372a7 | ||
|
|
0ac9228a41 | ||
|
|
79fcf7e9a9 | ||
|
|
63e1480d3d | ||
|
|
3d8f25f4b0 | ||
| d04752b2ba | |||
| c229b58d9d | |||
| 80f5b2fde7 | |||
|
|
6ca4695641 | ||
|
|
de8a64c509 | ||
|
|
c2c4759c68 | ||
|
|
7f6c134c57 | ||
| fa4c708e1c | |||
|
|
fa4bf3e8d4 | ||
|
|
2ff2aeb812 | ||
|
|
765b68f754 | ||
|
|
2f7003d3b7 | ||
|
|
0a6730a722 | ||
|
|
7bcfa7e0e0 | ||
| 060c5dc37f | |||
|
|
3e68f069ce | ||
|
|
9df5c5d358 | ||
|
|
0fd8a7fd8f | ||
| ca6035d7a1 | |||
|
|
ed846686ce | ||
|
|
7f429638b5 | ||
| 4733811487 | |||
| 9688e5eb1c | |||
| 34ada3ab98 | |||
|
|
95b2759a12 | ||
|
|
070473b0d6 | ||
|
|
affb89bb59 | ||
|
|
56b6290c71 | ||
|
|
96c186a590 | ||
|
|
326b2b2b87 | ||
|
|
09dcc021c8 | ||
| e249402043 | |||
|
|
1ae74a6fdb | ||
|
|
5337beeb65 | ||
|
|
db1fdee078 | ||
| 4719cf6c0f |
@@ -11,7 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreContra
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreBusinessLogic", "ComputerHardwareStoreBusinessLogic\ComputerHardwareStoreBusinessLogic.csproj", "{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreBusinessLogic", "ComputerHardwareStoreBusinessLogic\ComputerHardwareStoreBusinessLogic.csproj", "{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreDatabaseImplement", "ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj", "{09A57BE9-A653-4AAD-9FB2-1F8974F294CD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreDatabaseImplement", "ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj", "{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreREST", "ComputerHardwareStoreREST\ComputerHardwareStoreREST.csproj", "{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VendorClient", "VendorClient\VendorClient.csproj", "{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -35,10 +39,18 @@ Global
|
|||||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D32DEB60-AF40-46AF-8914-DC6A19BD66CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{09A57BE9-A653-4AAD-9FB2-1F8974F294CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{09A57BE9-A653-4AAD-9FB2-1F8974F294CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{09A57BE9-A653-4AAD-9FB2-1F8974F294CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{09A57BE9-A653-4AAD-9FB2-1F8974F294CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{93BD4E28-48D8-4D3A-87FB-FB96F00DA64B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.Date))
|
if (string.IsNullOrEmpty(model.Text))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет даты у комментария", nameof(model.Date));
|
throw new ArgumentNullException("Нет текста комментария", nameof(model.Text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,10 +92,6 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (model.DateCreate == null) // TODO чего блин, всмысле нет
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет даты создания покупки", nameof(model.Date));
|
|
||||||
}
|
|
||||||
if (model.Cost <= 0)
|
if (model.Cost <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Стоимость покупки должна быть больше 0", nameof(model.Cost));
|
throw new ArgumentNullException("Стоимость покупки должна быть больше 0", nameof(model.Cost));
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ namespace ComputerHardwareStoreContracts.BindingModels
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
||||||
|
public IStoreKeeperModel StoreKeeper { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace ComputerHardwareStoreContracts.BindingModels
|
|||||||
public int VendorId { get; set; }
|
public int VendorId { get; set; }
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
|
public DateTime? DateImplement { get; set; }
|
||||||
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; set; } = new();
|
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; set; } = new();
|
||||||
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; set; } = new();
|
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IBuildLogic
|
||||||
|
{
|
||||||
|
List<BuildViewModel>? ReadList(BuildSearchModel? model);
|
||||||
|
BuildViewModel? ReadElement(BuildSearchModel model);
|
||||||
|
bool Create(BuildBindingModel model);
|
||||||
|
bool Update(BuildBindingModel model);
|
||||||
|
bool Delete(BuildBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ICommentLogic
|
||||||
|
{
|
||||||
|
List<CommentViewModel>? ReadList(CommentSearchModel? model);
|
||||||
|
CommentViewModel? ReadElement(CommentSearchModel model);
|
||||||
|
bool Create(CommentBindingModel model);
|
||||||
|
bool Update(CommentBindingModel model);
|
||||||
|
bool Delete(CommentBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IPurchaseLogic
|
||||||
|
{
|
||||||
|
List<PurchaseViewModel>? ReadList(PurchaseSearchModel? model);
|
||||||
|
PurchaseViewModel? ReadElement(PurchaseSearchModel model);
|
||||||
|
bool Create(PurchaseBindingModel model);
|
||||||
|
bool Update(PurchaseBindingModel model);
|
||||||
|
bool Delete(PurchaseBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,12 @@ using ComputerHardwareStoreContracts.ViewModels;
|
|||||||
|
|
||||||
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
|
namespace ComputerHardwareStoreContracts.BusinessLogicsContracts
|
||||||
{
|
{
|
||||||
public interface IStoreKeeperLogic
|
public interface IStoreKeeperLogic
|
||||||
{
|
{
|
||||||
List<StoreKeeperViewModel>? ReadList(StoreKeeperSearchModel? model);
|
List<StoreKeeperViewModel>? ReadList(StoreKeeperSearchModel? model);
|
||||||
StoreKeeperViewModel? ReadElement(StoreKeeperSearchModel model);
|
StoreKeeperViewModel? ReadElement(StoreKeeperSearchModel model);
|
||||||
bool Create(StoreKeeperBindingModel model);
|
bool Create(StoreKeeperBindingModel model);
|
||||||
bool Update(StoreKeeperBindingModel model);
|
bool Update(StoreKeeperBindingModel model);
|
||||||
bool Delete(StoreKeeperBindingModel model);
|
bool Delete(StoreKeeperBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,6 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="BusinessLogicsContracts\IStoreKeeperLogic.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="BusinessLogicsContracts\IStoreKeeperLogic.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ComputerHardwareStoreDataModels\ComputerHardwareStoreDataModels.csproj" />
|
<ProjectReference Include="..\ComputerHardwareStoreDataModels\ComputerHardwareStoreDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
public class BuildSearchModel
|
public class BuildSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public int VendorId { get; set; }
|
||||||
|
public int? ProductId { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,5 @@
|
|||||||
public class CommentSearchModel
|
public class CommentSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public DateTime? Date { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
public int? StoreKeeperId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,7 @@
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
public int StoreKeeperId { get; set; }
|
||||||
|
public int? BuildId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
public class PurchaseSearchModel
|
public class PurchaseSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public int? VendorId { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,5 @@
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Login { get; set; }
|
public string? Login { get; set; }
|
||||||
public string? Password { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ namespace ComputerHardwareStoreContracts.ViewModels
|
|||||||
[DisplayName("Цена")]
|
[DisplayName("Цена")]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new();
|
||||||
|
public IStoreKeeperModel StoreKeeper { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ namespace ComputerHardwareStoreContracts.ViewModels
|
|||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
[DisplayName("Дата создания")]
|
[DisplayName("Дата создания")]
|
||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
|
public DateTime? DateImplement { get; set; }
|
||||||
public int VendorId { get; set; }
|
public int VendorId { get; set; }
|
||||||
[DisplayName("Сумма")]
|
[DisplayName("Сумма")]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; set; } = new();
|
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; set; } = new();
|
||||||
|
|
||||||
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; set; } = new();
|
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
double Price { get; }
|
double Price { get; }
|
||||||
|
public IStoreKeeperModel StoreKeeper { get; }
|
||||||
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
|
public Dictionary<int, (IComponentModel, int)> ProductComponents { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
int VendorId { get; }
|
int VendorId { get; }
|
||||||
double Cost { get; }
|
double Cost { get; }
|
||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
|
DateTime? DateImplement { get; }
|
||||||
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; }
|
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds { get; }
|
||||||
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; }
|
public Dictionary<int, (IProductModel, int)> PurchaseProducts { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,7 @@ namespace ComputerHardwareStoreDatabaseImplement
|
|||||||
{
|
{
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
/*
|
optionsBuilder.UseNpgsql("Host=192.168.1.61:5432;Database=computerhardwarestore;Username=compstore;Password=compstore");
|
||||||
* в program добавить:
|
|
||||||
* // получаем строку подключения из файла конфигурации
|
|
||||||
* string connection = builder.Configuration.GetConnectionString("DefaultConnection");
|
|
||||||
*
|
|
||||||
* // добавляем контекст ApplicationContext в качестве сервиса в приложение
|
|
||||||
* builder.Services.AddDbContext<ApplicationContext>(options => options.UseSqlServer(connection));
|
|
||||||
*
|
|
||||||
* в appsettings:
|
|
||||||
* "ConnectionStrings": {
|
|
||||||
* "DefaultConnection": "Host=localhost;Database=ProductBar_db;Username=compstore;Password=compstore"
|
|
||||||
* },
|
|
||||||
*/
|
|
||||||
|
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
@@ -28,6 +16,7 @@ namespace ComputerHardwareStoreDatabaseImplement
|
|||||||
public virtual DbSet<Component> Components { set; get; }
|
public virtual DbSet<Component> Components { set; get; }
|
||||||
public virtual DbSet<Product> Products { set; get; }
|
public virtual DbSet<Product> Products { set; get; }
|
||||||
public virtual DbSet<ProductComponent> ProductComponents { set; get; }
|
public virtual DbSet<ProductComponent> ProductComponents { set; get; }
|
||||||
|
|
||||||
public virtual DbSet<StoreKeeper> StoreKeepers { set; get; }
|
public virtual DbSet<StoreKeeper> StoreKeepers { set; get; }
|
||||||
public virtual DbSet<Build> Builds { set; get; }
|
public virtual DbSet<Build> Builds { set; get; }
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class BuildStorage : IBuildStorage
|
||||||
|
{
|
||||||
|
public List<BuildViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Builds
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Select(b => b.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BuildViewModel> GetFilteredList(BuildSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Builds
|
||||||
|
// только те, что созданы пользователем
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Where(b => b.Vendor.Id == model.VendorId
|
||||||
|
// если есть хотя бы 1 общий компонент с товарами
|
||||||
|
&& !model.ProductId.HasValue || b.Components.FirstOrDefault(
|
||||||
|
c => c.Component.ProductComponents.FirstOrDefault(
|
||||||
|
p => p.ProductId == model.ProductId)
|
||||||
|
!= null)
|
||||||
|
!= null)
|
||||||
|
// вместе с комментами
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
// вместе с компонентами
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.Select(b => b.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BuildViewModel? GetElement(BuildSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Builds
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Where(b => b.Vendor.Id == model.VendorId)
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.FirstOrDefault(b =>
|
||||||
|
(!string.IsNullOrEmpty(model.Name) && b.Name == model.Name) ||
|
||||||
|
(model.Id.HasValue && b.Id == model.Id))?
|
||||||
|
.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BuildViewModel? Insert(BuildBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newBuild = Build.Create(context, model);
|
||||||
|
if (newBuild == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Builds.Add(newBuild);
|
||||||
|
context.SaveChanges();
|
||||||
|
return context.Builds
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.FirstOrDefault(p => p.Id == newBuild.Id)?
|
||||||
|
.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BuildViewModel? Update(BuildBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var build = context.Builds
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Where(b => b.Vendor.Id == model.Vendor.Id)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (build == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return build.GetViewModel;
|
||||||
|
}
|
||||||
|
public BuildViewModel? Delete(BuildBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var build = context.Builds
|
||||||
|
.Include(b => b.Comments)
|
||||||
|
.Include(b => b.Components)
|
||||||
|
.ThenInclude(b => b.Component)
|
||||||
|
.Include(b => b.Vendor)
|
||||||
|
.Where(b => b.Vendor.Id == model.Vendor.Id)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (build == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Builds.Remove(build);
|
||||||
|
context.SaveChanges();
|
||||||
|
return build.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class CommentStorage : ICommentStorage
|
||||||
|
{
|
||||||
|
public List<CommentViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Comments
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CommentViewModel> GetFilteredList(CommentSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Comments
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommentViewModel? GetElement(CommentSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Comments
|
||||||
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommentViewModel? Insert(CommentBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newComment = Comment.Create(model);
|
||||||
|
if (newComment == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Comments.Add(newComment);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newComment.GetViewModel;
|
||||||
|
}
|
||||||
|
public CommentViewModel? Update(CommentBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Comments.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
element.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommentViewModel? Delete(CommentBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Comments.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Comments.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
return context.Components
|
return context.Components
|
||||||
.Select(x => x.GetViewModel)
|
.Select(c => c.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,12 +20,12 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
if (string.IsNullOrEmpty(model.Name))
|
||||||
{
|
{
|
||||||
return new ();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
return context.Components
|
return context.Components
|
||||||
.Where(x => x.Name.Contains(model.Name))
|
.Where(c => c.Name.Contains(model.Name))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(c => c.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,17 +37,16 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
return context.Components
|
return context.Components
|
||||||
.FirstOrDefault(x =>
|
.FirstOrDefault(c =>
|
||||||
(!string.IsNullOrEmpty(model.Name)
|
(!string.IsNullOrEmpty(model.Name) && c .Name == model.Name) ||
|
||||||
&& x.Name == model.Name)
|
(model.Id.HasValue && c.Id == model.Id))
|
||||||
|| (model.Id.HasValue && x.Id == model.Id))
|
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComponentViewModel? Insert(ComponentBindingModel model)
|
public ComponentViewModel? Insert(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
var newComponent = Component.Create(context, model);
|
var newComponent = Component.Create(model);
|
||||||
if (newComponent == null)
|
if (newComponent == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -59,27 +58,27 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
|
|||||||
public ComponentViewModel? Update(ComponentBindingModel model)
|
public ComponentViewModel? Update(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
var component = context.Components.FirstOrDefault(x => x.Id == model.Id);
|
var element = context.Components.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (component == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
component.Update(model);
|
element.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return component.GetViewModel;
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComponentViewModel? Delete(ComponentBindingModel model)
|
public ComponentViewModel? Delete(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ComputerHardwareStoreDBContext();
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
var element = context.Components.FirstOrDefault(rec => rec.Id == model.Id);
|
var element = context.Components.FirstOrDefault(c => c.Id == model.Id);
|
||||||
if (element != null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
context.Components.Remove(element);
|
return null;
|
||||||
context.SaveChanges();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
}
|
||||||
return null;
|
context.Components.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class OrderStorage : IOrderStorage
|
||||||
|
{
|
||||||
|
public List<OrderViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Orders
|
||||||
|
.Include(o => o.Products)
|
||||||
|
.ThenInclude(o => o.Product)
|
||||||
|
.Select(o => o.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Orders
|
||||||
|
.Include(o => o.Products)
|
||||||
|
.ThenInclude(o => o.Product)
|
||||||
|
.Where(o =>
|
||||||
|
(model.Id.HasValue && o.Id == model.Id) ||
|
||||||
|
((model.DateFrom.HasValue && model.DateTo.HasValue) &&
|
||||||
|
((model.DateFrom <= o.DateCreate && o.DateCreate <= model.DateTo) ||
|
||||||
|
(o.DateImplement.HasValue && o.DateCreate < model.DateFrom && model.DateFrom < o.DateImplement)))
|
||||||
|
)
|
||||||
|
.Select(o => o.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Orders
|
||||||
|
.Include(o => o.Products)
|
||||||
|
.ThenInclude(o => o.Product)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id)?
|
||||||
|
.GetViewModel;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
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 ComputerHardwareStoreDBContext();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var order = context.Orders
|
||||||
|
.Include(o => o.Products)
|
||||||
|
.ThenInclude(o => o.Product)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id);
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
order.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
transaction.Commit();
|
||||||
|
return order.GetViewModel;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Orders
|
||||||
|
.Include(o => o.Products)
|
||||||
|
.ThenInclude(o => o.Product)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Orders.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class ProductStorage : IProductStorage
|
||||||
|
{
|
||||||
|
public List<ProductViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Products
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.Select(p => p.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProductViewModel> GetFilteredList(ProductSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Products
|
||||||
|
.Where(p => (p.StoreKeeper.Id == model.StoreKeeperId)
|
||||||
|
// есть хотя бы 1 общий со сборкой компонент
|
||||||
|
&& (!model.BuildId.HasValue || p.Components.FirstOrDefault
|
||||||
|
(c => c.Component.BuldComponents.FirstOrDefault(
|
||||||
|
b => b.BuildId == model.BuildId)
|
||||||
|
!= null)
|
||||||
|
!= null))
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.Select(p => p.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductViewModel? GetElement(ProductSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Products
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.FirstOrDefault(p =>
|
||||||
|
(!string.IsNullOrEmpty(model.Name) && p.Name == model.Name) ||
|
||||||
|
(model.Id.HasValue && p.Id == model.Id))?
|
||||||
|
.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductViewModel? Insert(ProductBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newProduct = Product.Create(context, model);
|
||||||
|
if (newProduct == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Products.Add(newProduct);
|
||||||
|
context.SaveChanges();
|
||||||
|
return context.Products
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.FirstOrDefault(p => p.Id == newProduct.Id)?
|
||||||
|
.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductViewModel? Update(ProductBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var product = context.Products
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return product.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductViewModel? Delete(ProductBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var product = context.Products
|
||||||
|
.Include(p => p.Components)
|
||||||
|
.ThenInclude(p => p.Component)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (product == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Products.Remove(product);
|
||||||
|
context.SaveChanges();
|
||||||
|
return product.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class PurchaseStorage : IPurchaseStorage
|
||||||
|
{
|
||||||
|
public List<PurchaseViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Purchases
|
||||||
|
.Include(p => p.Builds)
|
||||||
|
.ThenInclude(p => p.Build)
|
||||||
|
.Include(p => p.Products)
|
||||||
|
.ThenInclude(p => p.Product)
|
||||||
|
.Select(p => p.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Purchases
|
||||||
|
.Include(p => p.Builds)
|
||||||
|
.ThenInclude(p => p.Build)
|
||||||
|
.Include(p => p.Products)
|
||||||
|
.ThenInclude(p => p.Product)
|
||||||
|
.Where(p =>
|
||||||
|
(model.Id.HasValue && p.Id == model.Id) ||
|
||||||
|
((model.DateFrom.HasValue && model.DateTo.HasValue) &&
|
||||||
|
((model.DateFrom <= p.DateCreate && p.DateCreate <= model.DateTo) ||
|
||||||
|
(p.DateImplement.HasValue && p.DateCreate < model.DateFrom && model.DateFrom < p.DateImplement)))
|
||||||
|
)
|
||||||
|
.Select(p => p.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PurchaseViewModel? GetElement(PurchaseSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Purchases
|
||||||
|
.Include(p => p.Builds)
|
||||||
|
.ThenInclude(p => p.Build)
|
||||||
|
.Include(p => p.Products)
|
||||||
|
.ThenInclude(p => p.Product)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id)?
|
||||||
|
.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PurchaseViewModel? Insert(PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newPurchase = Purchase.Create(context, model);
|
||||||
|
if (newPurchase == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Purchases.Add(newPurchase);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newPurchase.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PurchaseViewModel? Update(PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
using var transaction = context.Database.BeginTransaction();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var purchase = context.Purchases
|
||||||
|
.Include(p => p.Builds)
|
||||||
|
.ThenInclude(p => p.Build)
|
||||||
|
.Include(p => p.Products)
|
||||||
|
.ThenInclude(p => p.Product)
|
||||||
|
.FirstOrDefault(p => p.Id == model.Id);
|
||||||
|
if (purchase == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
purchase.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
transaction.Commit();
|
||||||
|
return purchase.GetViewModel;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PurchaseViewModel? Delete(PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Purchases
|
||||||
|
.Include(p => p.Builds)
|
||||||
|
.ThenInclude(p => p.Build)
|
||||||
|
.Include(p => p.Products)
|
||||||
|
.ThenInclude(p => p.Product)
|
||||||
|
.FirstOrDefault(o => o.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Purchases.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class StoreKeeperStorage : IStoreKeeperStorage
|
||||||
|
{
|
||||||
|
public StoreKeeperViewModel? GetElement(StoreKeeperSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Login) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.StoreKeepers
|
||||||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Login)
|
||||||
|
&& x.Login == model.Login)
|
||||||
|
|| (model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StoreKeeperViewModel> GetFilteredList(StoreKeeperSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Login))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.StoreKeepers
|
||||||
|
.Where(x => x.Login.Contains(model.Login))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StoreKeeperViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.StoreKeepers
|
||||||
|
.Include(x => x.Components)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StoreKeeperViewModel? Insert(StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newStoreKeeper = StoreKeeper.Create(context, model);
|
||||||
|
if (newStoreKeeper == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.StoreKeepers.Add(newStoreKeeper);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newStoreKeeper.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StoreKeeperViewModel? Update(StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.StoreKeepers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
element.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
public StoreKeeperViewModel? Delete(StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.StoreKeepers.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.StoreKeepers.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Models;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class VendorStorage : IVendorStorage
|
||||||
|
{
|
||||||
|
public VendorViewModel? GetElement(VendorSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Login) && !model.Id.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Vendors
|
||||||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Login)
|
||||||
|
&& x.Login == model.Login)
|
||||||
|
|| (model.Id.HasValue && x.Id == model.Id))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VendorViewModel> GetFilteredList(VendorSearchModel model)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(model.Login))
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Vendors
|
||||||
|
.Where(x => x.Login.Contains(model.Login))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VendorViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
return context.Vendors
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VendorViewModel? Insert(VendorBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var newVendor = Vendor.Create(context, model);
|
||||||
|
if (newVendor == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
context.Vendors.Add(newVendor);
|
||||||
|
context.SaveChanges();
|
||||||
|
return newVendor.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VendorViewModel? Update(VendorBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Vendors.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
element.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
public VendorViewModel? Delete(VendorBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerHardwareStoreDBContext();
|
||||||
|
var element = context.Vendors.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
if (element != null)
|
||||||
|
{
|
||||||
|
context.Vendors.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
547
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501130816_fix.Designer.cs
generated
Normal file
547
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501130816_fix.Designer.cs
generated
Normal file
@@ -0,0 +1,547 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||||
|
[Migration("20240501130816_fix")]
|
||||||
|
partial class fix
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Builds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("BuildComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.ToTable("Comments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("OrderProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int?>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseBuilds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StoreKeepers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Vendors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Vendor");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("StoreKeeperId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("StoreKeeperЗЛ");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("StoreKeeperId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("ProductComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class fix : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Orders_Products_ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Orders_ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Count",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Comments_BuildId",
|
||||||
|
table: "Comments",
|
||||||
|
column: "BuildId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Comments_Builds_BuildId",
|
||||||
|
table: "Comments",
|
||||||
|
column: "BuildId",
|
||||||
|
principalTable: "Builds",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Comments_Builds_BuildId",
|
||||||
|
table: "Comments");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Comments_BuildId",
|
||||||
|
table: "Comments");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Count",
|
||||||
|
table: "Orders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ProductId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Orders_Products_ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ProductId",
|
||||||
|
principalTable: "Products",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
566
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501142223_cs2.Designer.cs
generated
Normal file
566
ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501142223_cs2.Designer.cs
generated
Normal file
@@ -0,0 +1,566 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||||
|
[Migration("20240501142223_cs2")]
|
||||||
|
partial class cs2
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Builds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("BuildComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.ToTable("Comments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("OrderProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int?>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseBuilds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StoreKeepers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Vendors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Vendor");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("BuldComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("StoreKeeperId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("StoreKeeperЗЛ");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", null)
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ProductId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("StoreKeeperId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("ProductComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("BuldComponents");
|
||||||
|
|
||||||
|
b.Navigation("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class cs2 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Count",
|
||||||
|
table: "Orders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ProductId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Orders_Products_ProductId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ProductId",
|
||||||
|
principalTable: "Products",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Orders_Products_ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Orders_ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Count",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProductId",
|
||||||
|
table: "Orders");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,563 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerHardwareStoreDBContext))]
|
||||||
|
partial class ComputerHardwareStoreDBContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Builds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("BuildComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Date")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Text")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.ToTable("Comments");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("OrderProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<int?>("StoreKeeperId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("StoreKeeperId");
|
||||||
|
|
||||||
|
b.ToTable("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.ToTable("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int>("VendorId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("VendorId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BuildId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseBuilds");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ProductId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PurchaseId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ProductId");
|
||||||
|
|
||||||
|
b.HasIndex("PurchaseId");
|
||||||
|
|
||||||
|
b.ToTable("PurchaseProducts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StoreKeepers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Login")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Vendors");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", "Vendor")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Vendor");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.BuildComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("BuldComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Comment", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", "StoreKeeperЗЛ")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("StoreKeeperId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("StoreKeeperЗЛ");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", null)
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ProductId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.OrderProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", null)
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("StoreKeeperId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.ProductComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("ProductComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Vendor", null)
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("VendorId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseBuild", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Build", "Build")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BuildId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Builds")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Build");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.PurchaseProduct", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Product", "Product")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProductId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerHardwareStoreDatabaseImplement.Models.Purchase", "Purchase")
|
||||||
|
.WithMany("Products")
|
||||||
|
.HasForeignKey("PurchaseId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Product");
|
||||||
|
|
||||||
|
b.Navigation("Purchase");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Build", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("BuldComponents");
|
||||||
|
|
||||||
|
b.Navigation("ProductComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Product", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Products");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerHardwareStoreDatabaseImplement.Models.Vendor", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Builds");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
using ComputerHardwareStoreContracts.BindingModels;
|
|
||||||
using ComputerHardwareStoreContracts.ViewModels;
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
using ComputerHardwareStoreDataModels.Models;
|
using ComputerHardwareStoreDataModels.Models;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace ComputerHardwareStoreDatabaseImplement.Models
|
namespace ComputerHardwareStoreDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
@@ -16,7 +14,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
|
[NotMapped]
|
||||||
private Dictionary<int, (IComponentModel, int)>? _buildComponents = null;
|
private Dictionary<int, (IComponentModel, int)>? _buildComponents = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IComponentModel, int)> BuildComponents
|
public Dictionary<int, (IComponentModel, int)> BuildComponents
|
||||||
@@ -77,7 +75,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
Price = model.Price;
|
Price = model.Price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildViewModel GetViewModel() => new()
|
public BuildViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Name = Name,
|
Name = Name,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
public string Text { get; set; } = string.Empty;
|
public string Text { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public int BuildId { get; set; }
|
public int BuildId { get; set; }
|
||||||
|
public virtual Build Build { get; set; } = new();
|
||||||
public static Comment? Create(CommentBindingModel model)
|
public static Comment? Create(CommentBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
|||||||
@@ -14,13 +14,15 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public virtual StoreKeeper? StoreKeeper { get; set; }
|
public virtual StoreKeeper? StoreKeeperЗЛ { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
IStoreKeeperModel IComponentModel.StoreKeeper => throw new NotImplementedException();
|
public IStoreKeeperModel? StoreKeeper { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ComponentId")]
|
[ForeignKey("ComponentId")]
|
||||||
public virtual List<ProductComponent> ProductComponents { get; set; } = new();
|
public virtual List<ProductComponent> ProductComponents { get; set; } = new();
|
||||||
public static Component? Create(ComputerHardwareStoreDBContext context, ComponentBindingModel model)
|
[ForeignKey("ComponentId")]
|
||||||
|
public virtual List<BuildComponent> BuldComponents { get; set; } = new();
|
||||||
|
public static Component? Create(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Cost = model.Cost,
|
Cost = model.Cost,
|
||||||
StoreKeeper = context.StoreKeepers.First(x => x.Id == model.StoreKeeper.Id)
|
StoreKeeper = model.StoreKeeper
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update (ComponentBindingModel model)
|
public void Update (ComponentBindingModel model)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
IStoreKeeperModel IProductModel.StoreKeeper => StoreKeeper;
|
||||||
|
public virtual StoreKeeper StoreKeeper {get; set;} = new();
|
||||||
private Dictionary<int, (IComponentModel, int)>? _productComponents = null;
|
private Dictionary<int, (IComponentModel, int)>? _productComponents = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IComponentModel, int)> ProductComponents
|
public Dictionary<int, (IComponentModel, int)> ProductComponents
|
||||||
@@ -61,7 +64,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
Name = Name,
|
Name = Name,
|
||||||
Price = Price,
|
Price = Price,
|
||||||
ProductComponents = ProductComponents
|
ProductComponents = ProductComponents,
|
||||||
|
StoreKeeper = StoreKeeper,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void UpdateComponents(ComputerHardwareStoreDBContext context, ProductBindingModel model)
|
public static void UpdateComponents(ComputerHardwareStoreDBContext context, ProductBindingModel model)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Models
|
|||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
public DateTime? DateImplement { get; set; } = null;
|
||||||
private Dictionary<int, (IBuildModel, int)>? _purchaseBuilds = null;
|
private Dictionary<int, (IBuildModel, int)>? _purchaseBuilds = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds
|
public Dictionary<int, (IBuildModel, int)> PurchaseBuilds
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ComputerHardwareStoreDatabaseImplement\ComputerHardwareStoreDatabaseImplement.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class BuildController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<BuildController> _logger;
|
||||||
|
private readonly IBuildStorage _storage;
|
||||||
|
|
||||||
|
public BuildController(ILogger<BuildController> logger, IBuildStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] BuildSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] BuildSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] BuildBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] BuildBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] BuildBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class CommentController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<CommentController> _logger;
|
||||||
|
private readonly ICommentStorage _storage;
|
||||||
|
|
||||||
|
public CommentController(ILogger<CommentController> logger, ICommentStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] CommentSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] CommentSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] CommentBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] CommentBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] CommentBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class OrderController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<OrderController> _logger;
|
||||||
|
private readonly IOrderStorage _storage;
|
||||||
|
|
||||||
|
public OrderController(ILogger<OrderController> logger, IOrderStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] OrderSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] OrderSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class ProductController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<ProductController> _logger;
|
||||||
|
private readonly IProductStorage _storage;
|
||||||
|
|
||||||
|
public ProductController(ILogger<ProductController> logger, IProductStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] ProductSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] ProductSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] ProductBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] ProductBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] ProductBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class PurchaseController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<PurchaseController> _logger;
|
||||||
|
private readonly IPurchaseStorage _storage;
|
||||||
|
|
||||||
|
public PurchaseController(ILogger<PurchaseController> logger, IPurchaseStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] PurchaseSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] PurchaseSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] PurchaseBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class StoreKeepersController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<StoreKeepersController> _logger;
|
||||||
|
private readonly IStoreKeeperStorage _storage;
|
||||||
|
|
||||||
|
public StoreKeepersController(ILogger<StoreKeepersController> logger, IStoreKeeperStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] StoreKeeperSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] StoreKeeperSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] StoreKeeperBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using ComputerHardwareStoreContracts.BindingModels;
|
||||||
|
using ComputerHardwareStoreContracts.SearchModels;
|
||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ComputerHardwareStoreREST.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class VendorController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<VendorController> _logger;
|
||||||
|
private readonly IVendorStorage _storage;
|
||||||
|
|
||||||
|
public VendorController(ILogger<VendorController> logger, IVendorStorage storage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_storage = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("get/filter")]
|
||||||
|
public IActionResult GetByFilter([FromBody] VendorSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetFilteredList(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("get")]
|
||||||
|
public IActionResult GetById([FromBody] VendorSearchModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.GetElement(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("create")]
|
||||||
|
public IActionResult Create([FromBody] VendorBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Insert(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPut("update")]
|
||||||
|
public IActionResult Update([FromBody] VendorBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Update(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost("delete")]
|
||||||
|
public IActionResult Delete([FromBody] VendorBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _storage.Delete(model);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
ComputerHardwareStore/ComputerHardwareStoreREST/Program.cs
Normal file
41
ComputerHardwareStore/ComputerHardwareStoreREST/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using ComputerHardwareStoreContracts.StorageContracts;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement;
|
||||||
|
using ComputerHardwareStoreDatabaseImplement.Implements;
|
||||||
|
using ComputerHardwareStoreREST;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
|
// получаем строку подключения из файла конфигурации
|
||||||
|
//DBSetting.ConectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
|
||||||
|
builder.Services.AddSingleton<IComponentStorage, ComponentStorage >();
|
||||||
|
builder.Services.AddSingleton<IStoreKeeperStorage, StoreKeeperStorage>();
|
||||||
|
builder.Services.AddSingleton<IProductStorage, ProductStorage>();
|
||||||
|
builder.Services.AddSingleton<IOrderStorage, OrderStorage>();
|
||||||
|
builder.Services.AddSingleton<IBuildStorage, BuildStorage>();
|
||||||
|
builder.Services.AddSingleton<ICommentStorage, CommentStorage>();
|
||||||
|
builder.Services.AddSingleton<IPurchaseStorage, PurchaseStorage>();
|
||||||
|
builder.Services.AddSingleton<IVendorStorage, VendorStorage>();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"ComputerHardwareStoreREST": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "https://localhost:63872;http://localhost:63873"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<environment names="Development">
|
||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
|
||||||
|
</script>
|
||||||
|
</environment>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Create";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Create</h1>
|
||||||
|
|
||||||
|
<h4>StoreKeeper</h4>
|
||||||
|
<hr />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<form asp-action="Create">
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Name" class="control-label"></label>
|
||||||
|
<input asp-for="Name" class="form-control" />
|
||||||
|
<span asp-validation-for="Name" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Login" class="control-label"></label>
|
||||||
|
<input asp-for="Login" class="form-control" />
|
||||||
|
<span asp-validation-for="Login" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Password" class="control-label"></label>
|
||||||
|
<input asp-for="Password" class="form-control" />
|
||||||
|
<span asp-validation-for="Password" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Create" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Delete";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Delete</h1>
|
||||||
|
|
||||||
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
|
<div>
|
||||||
|
<h4>StoreKeeper</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="row">
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Name)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Name)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Login)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Login)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Password)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Password)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<form asp-action="Delete">
|
||||||
|
<input type="hidden" asp-for="Id" />
|
||||||
|
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Details";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Details</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4>StoreKeeper</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="row">
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Name)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Name)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Login)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Login)
|
||||||
|
</dd>
|
||||||
|
<dt class = "col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.Password)
|
||||||
|
</dt>
|
||||||
|
<dd class = "col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.Password)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Edit" asp-route-id="@Model?.Id">Edit</a> |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
@model ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Edit</h1>
|
||||||
|
|
||||||
|
<h4>StoreKeeper</h4>
|
||||||
|
<hr />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<form asp-action="Edit">
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
<input type="hidden" asp-for="Id" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Name" class="control-label"></label>
|
||||||
|
<input asp-for="Name" class="form-control" />
|
||||||
|
<span asp-validation-for="Name" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Login" class="control-label"></label>
|
||||||
|
<input asp-for="Login" class="form-control" />
|
||||||
|
<span asp-validation-for="Login" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Password" class="control-label"></label>
|
||||||
|
<input asp-for="Password" class="form-control" />
|
||||||
|
<span asp-validation-for="Password" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Save" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
@model IEnumerable<ComputerHardwareStoreDatabaseImplement.Models.StoreKeeper>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Index";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1>Index</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create">Create New</a>
|
||||||
|
</p>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Name)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Login)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Password)
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Login)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Password)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||||
|
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||||
|
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
143
ComputerHardwareStore/VendorClient/Controllers/HomeController.cs
Normal file
143
ComputerHardwareStore/VendorClient/Controllers/HomeController.cs
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
using ComputerHardwareStoreContracts.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using VendorClient.Models;
|
||||||
|
|
||||||
|
namespace VendorClient.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
|
public HomeController(ILogger<HomeController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Privacy()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Enter()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Register()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult AddBuildToPurchase()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Builds()
|
||||||
|
{
|
||||||
|
return View(new List<BuildViewModel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult BuildCreate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult BuildDelete()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult BuildUpdate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CommentCreate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CommentDelete()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CommentUpdate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Comments()
|
||||||
|
{
|
||||||
|
return View(new List<CommentViewModel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ProductsList()
|
||||||
|
{
|
||||||
|
return View(new List<BuildViewModel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult PurchaseCreate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult PurchaseDelete()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Purchases()
|
||||||
|
{
|
||||||
|
return View(new List<PurchaseViewModel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult PurchaseUpdate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Report()
|
||||||
|
{
|
||||||
|
return View(new List<PurchaseViewModel>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Report(string password)
|
||||||
|
{
|
||||||
|
Response.Redirect("ReportOnly");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace VendorClient.Models
|
||||||
|
{
|
||||||
|
public class ErrorViewModel
|
||||||
|
{
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||||
|
}
|
||||||
|
}
|
||||||
23
ComputerHardwareStore/VendorClient/Program.cs
Normal file
23
ComputerHardwareStore/VendorClient/Program.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:27793",
|
||||||
|
"sslPort": 44393
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"applicationUrl": "http://localhost:5194",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"applicationUrl": "https://localhost:7085;http://localhost:5194",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
ComputerHardwareStore/VendorClient/VendorClient.csproj
Normal file
17
ComputerHardwareStore/VendorClient/VendorClient.csproj
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ComputerHardwareStoreContracts\ComputerHardwareStoreContracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
6
ComputerHardwareStore/VendorClient/VendorClient.http
Normal file
6
ComputerHardwareStore/VendorClient/VendorClient.http
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@VendorClient_HostAddress = http://localhost:5194
|
||||||
|
|
||||||
|
GET {{VendorClient_HostAddress}}/weatherforecast/
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
###
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "AddBuildToPurchase";
|
||||||
|
}
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="display-4">Добавить сборку в покупку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Покупка:</div>
|
||||||
|
<div class="col-8 ">
|
||||||
|
<select id="purchaseId" name="purchaseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Date"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Сборка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="productId" name="productId" class="form-control" asp-items="@(new SelectList(@ViewBag.Products,"Id", "ProductName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Количество:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="text" name="count" id="count" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Добавить" class="btn btn-success" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "BuildCreate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Создать сборку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="number" id="name" name="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Цена:</div>
|
||||||
|
<div class="col-8"><input type="text" id="cost" name="cost" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Создать" class="btn btn-success" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "BuildDelete";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Удалить сборку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Сборка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "BuildUpdate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Обновить сборку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Сборка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Цена:</div>
|
||||||
|
<div class="col-8"><input type="number" id="cost" name="cost" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center ">
|
||||||
|
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<<script>
|
||||||
|
$('#build').on('change', function () {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
var buildId = $('#build').val();
|
||||||
|
var buildData = @Html.Raw(Json.Serialize(ViewBag.Builds));
|
||||||
|
var selectedBuild = buildData.find(function (build) {
|
||||||
|
return build.id == buildId;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedBuild) {
|
||||||
|
$("#text").val(selectedBuild.address);
|
||||||
|
$("#cost").val(selectedBuild.cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
54
ComputerHardwareStore/VendorClient/Views/Home/Builds.cshtml
Normal file
54
ComputerHardwareStore/VendorClient/Views/Home/Builds.cshtml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<BuildViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Builds";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Сборки</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Войдите!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="BuildCreate">Создать сборку</a>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="BuildUpdate">Изменить сборку</a>
|
||||||
|
<a class="text-decoration-none text-black h5" asp-action="BuildDelete">Удаление магазина</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Название
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Цена
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var build in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => build.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => build.Name)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => build.Price)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "CommentCreate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Создать комментарий</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Заголовок:</div>
|
||||||
|
<div class="col-8"><input type="number" id="title" name="title" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Текст:</div>
|
||||||
|
<div class="col-8"><input type="text" id="text" name="text" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Сборка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Создать" class="btn btn-success" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "CommentDelete";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Удалить комментарий</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Комментарий:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="comment" name="comment" class="form-control" asp-items="@(new SelectList(@ViewBag.Comments,"Id", "Text"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "CommentUpdate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Обновить комметрарий</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Комментарий:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="comment" name="comment" class="form-control" asp-items="@(new SelectList(@ViewBag.Comments,"Id", "Text"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Заголовок:</div>
|
||||||
|
<div class="col-8"><input type="text" id="title" name="title" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Текст:</div>
|
||||||
|
<div class="col-8"><input type="text" id="text" name="text" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Сборка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center ">
|
||||||
|
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<<script>
|
||||||
|
$('#comment').on('change', function () {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
var commentId = $('#comment').val();
|
||||||
|
var commentData = @Html.Raw(Json.Serialize(ViewBag.Comments));
|
||||||
|
var selectedComment = commentData.find(function (comment) {
|
||||||
|
return comment.id == commentId;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedComment) {
|
||||||
|
$("#title").val(selectedComment.title);
|
||||||
|
$("#text").val(selectedComment.text);
|
||||||
|
$("#build").val(selectedComment.buildId).change(); // <!-- в работоспособности не уверен -->
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<CommentViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Comments";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Комментарии</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Войди кому говорят!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="CommentCreate">Создать комментарий</a>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="CommentUpdate">изменить коммментарий</a>
|
||||||
|
<a class="text-decoration-none text-black h5" asp-action="CommentDelete">Удалить комментарий</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Заголовок
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Текст
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var comment in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => comment.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => comment.Text)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
20
ComputerHardwareStore/VendorClient/Views/Home/Enter.cshtml
Normal file
20
ComputerHardwareStore/VendorClient/Views/Home/Enter.cshtml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Enter";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Вход в приложение</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Логин:</div>
|
||||||
|
<div class="col-8"><input type="text" name="login" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Пароль:</div>
|
||||||
|
<div class="col-8"><input type="password" name="password" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Войти" class="btn btnprimary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<img src="./Images/Logo.jpg" alt="logo">
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<BuildViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "ProductsList";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Товары по сборкам</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<form method="post">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Войдите!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Формат сохранения:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="radio" id="xlc" name="saveFormat" value="xlc">
|
||||||
|
<label for="xlc">XLC</label>
|
||||||
|
<input type="radio" id="doc" name="saveFormat" value="doc">
|
||||||
|
<label for="doc">DOC</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Выберите файл:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="file" id="fileSave" name="fileSave" style="display:none">
|
||||||
|
<button type="button" onclick="document.getElementById('fileSave').click();">Выбрать файл</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Выберите сборки:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="assemblies" multiple>
|
||||||
|
@foreach (var build in Model)
|
||||||
|
{
|
||||||
|
<option value="@build.Id">@build.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Сохранить список" class="btn btn-success" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<ProductViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "PurchaseCreate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Создать покупку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Надо войти!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Сумма:</div>
|
||||||
|
<div class="col-8"><input type="number" id="summ" name="summ" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Адрес:</div>
|
||||||
|
<div class="col-8"><input type="text" id="address" name="address" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">Товары:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select name="products" multiple>
|
||||||
|
@foreach (var product in Model)
|
||||||
|
{
|
||||||
|
<option value="@product.Id">@product.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Создать" class="btn btn-success" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "PurchaseDelete";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Удалить покупку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Покупка от даты:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="purchase" name="purchase" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Data"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "PurchaseUpdate";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4 mb-5">Обновить покупку</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Покупка:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="purchase" name="purchase" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Date"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Адрес:</div>
|
||||||
|
<div class="col-8"><input type="text" id="address" name="address" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Сумма:</div>
|
||||||
|
<div class="col-8"><input type="number" id="summ" name="summ" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Товары в покупке:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<table class="tableProducts">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Название</th>
|
||||||
|
<th>Количество</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="purchaseTableProducts">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-4">Сборки в покупке:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<table class="tableBuilds">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Название</th>
|
||||||
|
<th>Количество</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="purchaseTableBuilds">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center ">
|
||||||
|
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<<script>
|
||||||
|
$('#purchase').on('change', function () {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
var purchaseId = $('#purchase').val();
|
||||||
|
var purchaseData = @Html.Raw(Json.Serialize(ViewBag.Purchases));
|
||||||
|
var selectedPurchase = purchaseData.find(function (purchase) {
|
||||||
|
return purchase.id == purchaseId;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedPurchase) {
|
||||||
|
$("#address").val(selectedPurchase.address);
|
||||||
|
$("#summ").val(selectedPurchase.maxCountCars);
|
||||||
|
fillTableProducts(selectedPurchase.productsAndCounts);
|
||||||
|
fillTableBuilds(selectedPurchase.assembliesAndCounts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillTableProducts(purchaseProducts) {
|
||||||
|
$("#purchaseTableProducts").empty();
|
||||||
|
|
||||||
|
for (var product in purchaseProducts)
|
||||||
|
$("#purchaseTableProducts").append('<tr><td>' + purchaseProducts[product].item1 + '</td><td>' + purchaseProducts[product].item2 + '</td></tr>');
|
||||||
|
}
|
||||||
|
function fillTableBuilds(purchaseBuilds) {
|
||||||
|
$("#purchaseTableBuilds").empty();
|
||||||
|
|
||||||
|
for (var build in purchaseBuilds)
|
||||||
|
$("#purchaseTableBuilds").append('<tr><td>' + purchaseBuilds[build].item1 + '</td><td>' + purchaseBuilds[build].item2 + '</td></tr>');
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
@using ComputerHardwareStoreContracts.ViewModels
|
||||||
|
@model List<PurchaseViewModel>
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Purchases";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Покупки</h1>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Надо войти!</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="PurchaseCreate">Создать покупку</a>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="PurchaseUpdate">Изменить покупку</a>
|
||||||
|
<a class="text-decoration-none me-3 text-black h5" asp-action="AddBuildTo">Добавить сборку в покупку</a>
|
||||||
|
<a class="text-decoration-none text-black h5" asp-action="PurchaseDelete">Удалить покупку</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Номер
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Сумма
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Адрес
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var puchase in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => puchase.Id)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => puchase.DateCreate)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => puchase.Sum)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => puchase.DateImplement)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Register";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Регистрация</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Логин:</div>
|
||||||
|
<div class="col-8"><input type="text" name="login" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Пароль:</div>
|
||||||
|
<div class="col-8"><input type="password" name="password" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Имя:</div><div class="col-8"><input type="text" name="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Registration"
|
||||||
|
class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
63
ComputerHardwareStore/VendorClient/Views/Home/_Layout.cshtml
Normal file
63
ComputerHardwareStore/VendorClient/Views/Home/_Layout.cshtml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - AutomobilePlantClientApp</title>
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" asparea="" asp-controller="Home" asp-action="Index">Компьтерный магазин "Ты ж программист" </a>
|
||||||
|
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||||
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
|
||||||
|
<ul class="navbar-nav flex-grow-1">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Purchases">Покупки</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Builds">Сборки</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Comments">Комментарии</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ProductsList">Список товаров</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Report">Отчёт</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<main role="main" class="pb-3">
|
||||||
|
@RenderBody()
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
<footer class="border-top footer text-muted">
|
||||||
|
<div class="container">
|
||||||
|
© 2024 - Компьютерный магазин
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
@RenderSection("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
25
ComputerHardwareStore/VendorClient/Views/Shared/Error.cshtml
Normal file
25
ComputerHardwareStore/VendorClient/Views/Shared/Error.cshtml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@model ErrorViewModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@if (Model.ShowRequestId)
|
||||||
|
{
|
||||||
|
<p>
|
||||||
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||||
|
It can result in displaying sensitive information from exceptions to end users.
|
||||||
|
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||||
|
and restarting the app.
|
||||||
|
</p>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - ComputerStoreWorkerApp</title>
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
|
<link rel="stylesheet" href="~/ComputerStoreWorkerApp.styles.css" asp-append-version="true" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">ComputerStoreWorkerApp</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
|
<ul class="navbar-nav flex-grow-1">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<main role="main" class="pb-3">
|
||||||
|
@RenderBody()
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="border-top footer text-muted">
|
||||||
|
<div class="container">
|
||||||
|
© 2024 - ComputerStoreWorkerApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||||
|
for details on configuring this project to bundle and minify static web assets. */
|
||||||
|
|
||||||
|
a.navbar-brand {
|
||||||
|
white-space: normal;
|
||||||
|
text-align: center;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #0077cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-top {
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.border-bottom {
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-shadow {
|
||||||
|
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.accept-policy {
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
line-height: 60px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@using VendorClient
|
||||||
|
@using VendorClient.Models
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
ComputerHardwareStore/VendorClient/appsettings.json
Normal file
9
ComputerHardwareStore/VendorClient/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user