Compare commits
No commits in common. "d427de220001f4890ff4bb7549770037ee4eb27c" and "7fde2e5622118f78df358f613da52b7f00d047c3" have entirely different histories.
d427de2200
...
7fde2e5622
@ -7,13 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopRestApi", "Comp
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopDataModels", "ComputerShopDataModels\ComputerShopDataModels.csproj", "{BBCF398B-D800-4D8D-99E8-F7ED2CC14A65}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopContracts", "ComputerShopContracts\ComputerShopContracts.csproj", "{B197888D-702B-4122-BFBF-BA6BCB49C0F3}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopContracts", "ComputerShopContracts\ComputerShopContracts.csproj", "{B197888D-702B-4122-BFBF-BA6BCB49C0F3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopBusinessLogic", "ComputerShopBusinessLogic\ComputerShopBusinessLogic.csproj", "{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopBusinessLogic", "ComputerShopBusinessLogic\ComputerShopBusinessLogic.csproj", "{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopDatabaseImplement", "ComputerShopDatabaseImplement\ComputerShopDatabaseImplement.csproj", "{CDE4C963-67B5-47A6-A394-901E95EA40F7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerShopImplementerApp", "ComputerShopImplementerApp\ComputerShopImplementerApp.csproj", "{0E13C365-F2CC-4A32-BDD0-52E2DB324734}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopDatabaseImplement", "ComputerShopDatabaseImplement\ComputerShopDatabaseImplement.csproj", "{CDE4C963-67B5-47A6-A394-901E95EA40F7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -41,10 +39,6 @@ Global
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0E13C365-F2CC-4A32-BDD0-52E2DB324734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0E13C365-F2CC-4A32-BDD0-52E2DB324734}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0E13C365-F2CC-4A32-BDD0-52E2DB324734}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0E13C365-F2CC-4A32-BDD0-52E2DB324734}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,162 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.BusinessLogicContracts;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class OrderLogic : IOrderLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
//Хранение всех заказов
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
{
|
||||
//model.UserId = -1 для swagger, чтобы можно было считать все заказы всех пользователей
|
||||
var list = (model == null || model.UserId == -1) ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var element = _orderStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement order not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement order found. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.DateCreate > DateTime.Now)
|
||||
{
|
||||
throw new ArgumentException($"Дата создания заказа {model.DateCreate} не может быть в будущем");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Create(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
model.Status = OrderStatus.Принят;
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
public bool Update(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
if (order == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(order));
|
||||
}
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(OrderBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_orderStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete order operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
private bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
if (order == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(order));
|
||||
}
|
||||
if (newStatus - model.Status == 1)
|
||||
{
|
||||
model.Status = newStatus;
|
||||
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update order operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (order.Status + 1 != newStatus)
|
||||
{
|
||||
_logger.LogWarning("Change status operation failed. Incorrect new status: {newStatus}. Current status: {currStatus}", newStatus, order.Status);
|
||||
return false;
|
||||
}
|
||||
_logger.LogWarning("Changing status operation faled: current:{Status}: required:{newStatus}.", model.Status, newStatus);
|
||||
throw new ArgumentException($"Невозможно присвоить статус {newStatus} заказу с текущим статусом {model.Status}");
|
||||
}
|
||||
|
||||
//Перевод заказа в состояние выполнения
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||
}
|
||||
|
||||
//Перевод заказа в состояние готовности
|
||||
public bool FinishOrder(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Готов);
|
||||
}
|
||||
//Перевод заказа в состояние выдачи (окончательное завершение)
|
||||
public bool DeliveryOrder(OrderBindingModel model)
|
||||
{
|
||||
return ChangeStatus(model, OrderStatus.Выдан);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.BusinessLogicContracts;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class RequestLogic : IRequestLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRequestStorage _requestStorage;
|
||||
public RequestLogic(ILogger<RequestLogic> logger, IRequestStorage requestStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_requestStorage = requestStorage;
|
||||
}
|
||||
|
||||
public List<RequestViewModel>? ReadList(RequestSearchModel? model)
|
||||
{
|
||||
//model.UserId = -1 для swagger, чтобы можно было считать все заявки всех пользователей
|
||||
var list = (model == null || model.UserId == -1) ? _requestStorage.GetFullList() : _requestStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList requests return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList requests.Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public RequestViewModel? ReadElement(RequestSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
var element = _requestStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement request not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement reguest found Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_requestStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_requestStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//!!!мб УДАЛИТЬ
|
||||
//public bool AddOrder(int requestId, int orderId)
|
||||
//{
|
||||
// return _requestStorage.ConnectRequestAssembly(requestId, assemblyId);
|
||||
//}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
public bool ConnectRequestAssembly(int requestId, int assemblyId)
|
||||
{
|
||||
_logger.LogInformation("Connect Assembly {rId} with request {aId}", requestId, assemblyId);
|
||||
return _requestStorage.ConnectRequestAssembly(requestId, assemblyId);
|
||||
}
|
||||
|
||||
public bool Delete(RequestBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_requestStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//!!!мб проверять, что есть userID
|
||||
private void CheckModel(RequestBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет ФИО клиента, оформившего заявку", nameof(model.ClientFIO));
|
||||
}
|
||||
if (model.DateRequest > DateTime.Now)
|
||||
{
|
||||
throw new ArgumentException($"Дата оформления заявки {model.DateRequest} не может быть в будущем");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.BusinessLogicContracts;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ComputerShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ShipmentLogic : IShipmentLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IShipmentStorage _shipmentStorage;
|
||||
|
||||
public ShipmentLogic(ILogger<ShipmentLogic> logger, IShipmentStorage shipmentStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_shipmentStorage = shipmentStorage;
|
||||
}
|
||||
|
||||
//!!!ТУТ МБ ПО-ДРУГОМУ ПРИСВАИВАТЬ ЗНАЧЕНИЕ ДЛЯ list (через fulllist)
|
||||
//!!!ИЛИ СОЗДАТЬ ОТДЕЛЬНЫЙ МЕТОД ReadListUser
|
||||
public List<ShipmentViewModel> ReadList(ShipmentSearchModel? model)
|
||||
{
|
||||
//model.UserId = -1 для swagger, чтобы можно было считать все партии товаров всех пользователей
|
||||
var list = (model == null || model.UserId == -1) ? _shipmentStorage.GetFullList() : _shipmentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public ShipmentViewModel? ReadElement(ShipmentSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var shipment = _shipmentStorage.GetElement(model);
|
||||
if (shipment == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement shipment not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement found. Id:{Id}", shipment.Id);
|
||||
return shipment;
|
||||
}
|
||||
|
||||
public bool Create(ShipmentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shipmentStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(ShipmentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shipmentStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(ShipmentBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_shipmentStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ShipmentBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.ProviderName))
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени поставщика", nameof(model.ProviderName));
|
||||
}
|
||||
if (model.DateShipment > DateTime.Now)
|
||||
{
|
||||
throw new ArgumentException($"Дата поступления {model.DateShipment} партии товаров не может быть в будущем");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,138 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.BusinessLogicContracts;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class UserLogic : IUserLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserStorage _userStorage;
|
||||
|
||||
public UserLogic(ILogger<IUserLogic> logger, IUserStorage userStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_userStorage = userStorage;
|
||||
}
|
||||
|
||||
//!!!мб поменять текст для логов
|
||||
public List<UserViewModel>? ReadList(UserSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("User ReadList. Login:{Login} Emain:{Email} Id:{Id}", model?.Login, model?.Email, model?.Id);
|
||||
var list = model == null ? _userStorage.GetFullList() : _userStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public UserViewModel? ReadElement(UserSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Login:{Login}. Email:{Email}. Id:{Id}", model?.Login, model?.Email, model?.Id);
|
||||
var element = _userStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_userStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//!!!мб проверять, что есть userID
|
||||
private void CheckModel(UserBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина пользователя", nameof(model.Login));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
throw new ArgumentNullException("Нет почты пользователя", nameof(model.Email));
|
||||
}
|
||||
//Проверка на уникальность. Проверить одной сущностью или 2-мя (один с таким же логином, второй с такой же почтой)?
|
||||
|
||||
//проверка уникальности логина
|
||||
var user1 = _userStorage.GetElement(new UserSearchModel
|
||||
{
|
||||
Login = model.Login
|
||||
});
|
||||
|
||||
if (user1 != null && user1.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пользователь с таким логином уже есть");
|
||||
}
|
||||
|
||||
//проверка уникальности почты
|
||||
var user2 = _userStorage.GetElement(new UserSearchModel
|
||||
{
|
||||
Email = model.Email
|
||||
});
|
||||
|
||||
if (user2 != null && user2.Id != model.Id) {
|
||||
throw new InvalidOperationException("Пользователь с такой почтой уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -14,4 +14,8 @@
|
||||
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="BusinessLogics\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -13,13 +13,15 @@ namespace ComputerShopContracts.BindingModels
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int? AssemblyId { get; set; }
|
||||
public int AssemblyId { get; set; }
|
||||
|
||||
public DateTime DateRequest { get; set; } = DateTime.Now;
|
||||
public DateTime DateMake { get; set; } = DateTime.Now;
|
||||
|
||||
//!!!МБ НЕ НАДО string.Empty
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, IOrderModel> RequestOrders { get; set; } = new();
|
||||
|
||||
//!!!ДОБАВИТЬ СТАТУС, ЕСЛИ БУДЕТ В ОБЫЧНОЙ МОДЕЛИ
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,7 +16,5 @@ namespace ComputerShopContracts.BindingModels
|
||||
public string Password { get; set; } = string.Empty;
|
||||
//!!!МБ НЕ НАДО string.Empty
|
||||
public string Email { get; set; } = string.Empty;
|
||||
//!!!МБ НЕ НАДО ПО УМОЛЧАНИЮ СТАВИТЬ "НЕИЗВЕСТНАЯ"
|
||||
public UserRole Role { get; set; } = UserRole.Неизвестная;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,7 @@ namespace ComputerShopContracts.BusinessLogicContracts
|
||||
{
|
||||
List<OrderViewModel>? ReadList(OrderSearchModel? model);
|
||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||
bool Create(OrderBindingModel model);
|
||||
bool Update(OrderBindingModel model);
|
||||
bool Delete(OrderBindingModel model);
|
||||
bool CreateOrder(OrderBindingModel model);
|
||||
bool TakeOrderInWork(OrderBindingModel model);
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
|
@ -17,6 +17,5 @@ namespace ComputerShopContracts.BusinessLogicContracts
|
||||
bool Create(RequestBindingModel model);
|
||||
bool Update(RequestBindingModel model);
|
||||
bool Delete(RequestBindingModel model);
|
||||
bool ConnectRequestAssembly(int requestId, int assemblyId);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,14 @@ namespace ComputerShopContracts.SearchModels
|
||||
//поиск по сборкам
|
||||
public int? AssemblyId { get; set; }
|
||||
|
||||
//!!!мб надо добавить поиск по заказам
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public string? ClientFIO { get; set; }
|
||||
|
||||
|
||||
//!!!МБ ДОБАВИТЬ ПОИСК ПО СТАТУСУ (ЕСЛИ ОСТАНЕТСЯ)
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ namespace ComputerShopContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
|
||||
//!!!мб надо добавить поиск по заказам
|
||||
public string? ProviderName { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
@ -1,5 +1,4 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -12,9 +11,8 @@ namespace ComputerShopContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? Login { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
//!!!ПОИСК ПО ПАРОЛЮ НЕ СТАЛ ДОБАВЛЯТЬ, ИБО СТРАННО
|
||||
|
||||
public string? Email { get; set; }
|
||||
public UserRole? Role { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,5 @@ namespace ComputerShopContracts.StorageContracts
|
||||
RequestViewModel? Insert(RequestBindingModel model);
|
||||
RequestViewModel? Update(RequestBindingModel model);
|
||||
RequestViewModel? Delete(RequestBindingModel model);
|
||||
bool ConnectRequestAssembly(int requestId, int assemblyId);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,10 @@ namespace ComputerShopContracts.ViewModels
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
|
||||
//!!!ТУТ МБ НАДО DisplayName (НО ВЯРД ЛИ)
|
||||
|
||||
//!!!УДАЛИТЬ (если нормально работает многие-ко-многим)
|
||||
|
@ -3,7 +3,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -15,23 +14,24 @@ namespace ComputerShopContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
//[DisplayName("Номер пользователя")]
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
//id сборки
|
||||
public int? AssemblyId { get; set; }
|
||||
//!!!МБ ДОБАВИТЬ НИК ПОЛЬЗОВАТЕЛЯ, СОЗДАВШЕГО ЗАЯВКУ
|
||||
|
||||
|
||||
public IAssemblyModel? Assembly { get; set; }
|
||||
public int AssemblyId { get; set; }
|
||||
|
||||
public Dictionary<int, IOrderModel> RequestOrders { get; set; } = new();
|
||||
|
||||
//!!!МБ НЕ НУЖНО DateTime.Now
|
||||
[DisplayName("Дата оформления")]
|
||||
public DateTime DateRequest { get; set; } = DateTime.Now;
|
||||
public DateTime DateMake { get; set; } = DateTime.Now;
|
||||
|
||||
//!!!МБ НЕ НУЖЕН string.Empty
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
|
||||
//!!!ЧТО-ТО СДЕЛАТЬ СО СТАТУСОМ (МБ УБРАТЬ ИЗ ER)
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,12 @@ namespace ComputerShopContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
|
||||
//!!!ТУТ МБ НЕ НУЖЕН DisplayName
|
||||
[DisplayName("Номер пользователя")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
//!!!МБ ДОБАВИТЬ НИК ПОЛЬЗОВАТЕЛЯ, СОЗДАВШЕГО ПАРТИЮ
|
||||
|
||||
|
||||
public Dictionary<int, IOrderModel> ShipmentOrders { get; set; } = new();
|
||||
|
||||
//!!!МБ НЕ НУЖЕН string.Empty
|
||||
|
@ -1,5 +1,4 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -23,8 +22,5 @@ namespace ComputerShopContracts.ViewModels
|
||||
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
//!!!МБ ТУТ НАДО DisplayName (НО ВРЯД ЛИ)
|
||||
public UserRole Role { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDataModels.Enums
|
||||
{
|
||||
public enum UserRole
|
||||
{
|
||||
Неизвестная = -1,
|
||||
Исполнитель = 0,
|
||||
Поручитель = 1
|
||||
}
|
||||
}
|
@ -17,18 +17,21 @@ namespace ComputerShopDataModels.Models
|
||||
/// <summary>
|
||||
/// ID сборки
|
||||
/// </summary>
|
||||
int? AssemblyId { get; }
|
||||
int AssemblyId { get; }
|
||||
|
||||
Dictionary<int, IOrderModel> RequestOrders { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания заявки
|
||||
/// </summary>
|
||||
DateTime DateRequest { get; }
|
||||
DateTime DateMake { get; }
|
||||
|
||||
/// <summary>
|
||||
/// ФИО клиента, для которого создана заявка
|
||||
/// </summary>
|
||||
string ClientFIO { get; }
|
||||
|
||||
|
||||
//!!!ЧТО-ТО СДЕЛАТЬ СО СТАТУСОМ (МБ УБРАТЬ ИЗ ER)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using ComputerShopDataModels.Enums;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -12,6 +11,5 @@ namespace ComputerShopDataModels.Models
|
||||
string Login { get; }
|
||||
string Password { get; }
|
||||
string Email { get; }
|
||||
UserRole Role { get; }
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace ComputerShopDatabaseImplement
|
||||
{
|
||||
if (!OptionsBuilder.IsConfigured)
|
||||
{
|
||||
OptionsBuilder.UseNpgsql(@"Host=localhost;Port=5000;Database=ComputerShop;Username=postgres;Password=admin");
|
||||
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputerShop;Username=postgres;Password=admin");
|
||||
}
|
||||
|
||||
base.OnConfiguring(OptionsBuilder);
|
||||
@ -17,23 +17,17 @@ namespace ComputerShopDatabaseImplement
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||
}
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
|
||||
public virtual DbSet<Component> Components { get; set; }
|
||||
public virtual DbSet<User> Users { get; set; }
|
||||
|
||||
public virtual DbSet<Assembly> Assemblies { get; set; }
|
||||
public virtual DbSet<Component> Components { get; set; }
|
||||
|
||||
public virtual DbSet<AssemblyComponent> AssemblyComponents { get; set; }
|
||||
public virtual DbSet<Assembly> Assemblies { get; set; }
|
||||
|
||||
public virtual DbSet<Product> Products { get; set; }
|
||||
public virtual DbSet<AssemblyComponent> AssemblyComponents { get; set; }
|
||||
|
||||
public virtual DbSet<ProductComponent> ProductComponents { get; set; }
|
||||
public virtual DbSet<Product> Products { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<Order> Orders { get; set; }
|
||||
public virtual DbSet<Request> Requests { get; set; }
|
||||
public virtual DbSet<Shipment> Shipments { get; set; }
|
||||
public virtual DbSet<ShipmentOrder> ShipmentOrders { get; set; }
|
||||
public virtual DbSet<RequestOrder> RequestOrders { get; set; }
|
||||
}
|
||||
public virtual DbSet<ProductComponent> ProductComponents { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,18 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Implements\**" />
|
||||
<EmbeddedResource Remove="Implements\**" />
|
||||
<None Remove="Implements\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="netcore-psql-util" Version="1.2.1" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,135 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Implements
|
||||
{
|
||||
//!!!ПОДОБИЕ component
|
||||
public class OrderStorage : IOrderStorage
|
||||
{
|
||||
//!!!ТУТ СВЯЗЬ С НЕСКОЛЬКИМИ СУЩНОСТЯМИ
|
||||
//!!!НЕ ФАКТ, ЧТО ПРАВИЛЬНО
|
||||
//!!!мб присоединять user
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.Shipments)
|
||||
.ThenInclude(x => x.Shipment)
|
||||
.Include(x => x.Requests)
|
||||
.ThenInclude(x => x.Request)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
//Учитывается id пользователя (везде получение списка только тех записей, что создал сам пользователь)
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
//сортировка по дате создания
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Where(x => (x.UserId == model.UserId) && (x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo))
|
||||
.Include(x => x.Shipments)
|
||||
.ThenInclude(x => x.Shipment)
|
||||
.Include(x => x.Requests)
|
||||
.ThenInclude(x => x.Request)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
//сортировка по статусу
|
||||
else if (model.Status.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Where(x => (x.UserId == model.UserId) && (x.Status == model.Status))
|
||||
.Include(x => x.Shipments)
|
||||
.ThenInclude(x => x.Shipment)
|
||||
.Include(x => x.Requests)
|
||||
.ThenInclude(x => x.Request)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
//возвращение просто всех заказов пользователя (замена GetFullList)
|
||||
return context.Orders
|
||||
.Where(x => x.UserId == model.UserId)
|
||||
.Include(x => x.Shipments)
|
||||
.ThenInclude(x => x.Shipment)
|
||||
.Include(x => x.Requests)
|
||||
.ThenInclude(x => x.Request)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
//Поиск только по id, потому что другие поля не уникальные - нет смысла искать 1 элемент
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Orders
|
||||
.Include(x => x.Shipments)
|
||||
.ThenInclude(x => x.Shipment)
|
||||
.Include(x => x.Requests)
|
||||
.ThenInclude(x => x.Request)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var newOrder = Order.Create(model);
|
||||
if (newOrder == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return newOrder.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (order == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
|
||||
//!!!МБ ТУТ ДЕЛАТЬ .Include(x => x.Shipments) и .Include(x => x.Requests)
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (order != null)
|
||||
{
|
||||
context.Orders.Remove(order);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Implements
|
||||
{
|
||||
//!!!ПОДОБИЕ textile
|
||||
public class RequestStorage : IRequestStorage
|
||||
{
|
||||
//!!!Проверить, что правильно присоединяю сборку Assembly
|
||||
public List<RequestViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Requests
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include(x => x.Assembly)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//!!!Проверить, что правильно присоединяю сборку Assembly
|
||||
//Учитывается id пользователя (везде получение списка только тех записей, что создал сам пользователь)
|
||||
public List<RequestViewModel> GetFilteredList(RequestSearchModel model) {
|
||||
using var context = new ComputerShopDatabase();
|
||||
|
||||
//сортировка по дате создания заявки
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Requests
|
||||
.Where(x => (x.UserId == model.UserId) && (x.DateRequest >= model.DateFrom && x.DateRequest <= model.DateTo))
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include(x => x.Assembly)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//сортировка по сборке (сборка может участвовать в нескольких заявках)
|
||||
else if (model.AssemblyId.HasValue)
|
||||
{
|
||||
return context.Requests
|
||||
.Where(x => x.UserId == model.UserId && x.AssemblyId == model.AssemblyId)
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include(x => x.Assembly)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//сортировка по фио клиента, для которого создана заявка
|
||||
else if (!string.IsNullOrEmpty(model.ClientFIO))
|
||||
{
|
||||
return context.Requests
|
||||
.Where(x => x.UserId == model.UserId && x.ClientFIO == model.ClientFIO)
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include (x => x.Assembly)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//возвращение просто всех заявок пользователя (замена GetFullList)
|
||||
return context.Requests
|
||||
.Where(x => x.UserId == model.UserId)
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include(x => x.Assembly)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//!!!Проверить, что правильно присоединяю сборку Assembly
|
||||
//!!!мб тут надо будет в FirstOrDefault добавить другие параметры
|
||||
//Поиск только по id, потому что другие поля не уникальные - нет смысла искать 1 элемент
|
||||
public RequestViewModel? GetElement(RequestSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Requests
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Include(x => x.Assembly)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public RequestViewModel? Insert(RequestBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var newRequest = Request.Create(context, model);
|
||||
if (newRequest == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Requests.Add(newRequest);
|
||||
context.SaveChanges();
|
||||
return newRequest.GetViewModel;
|
||||
}
|
||||
|
||||
public RequestViewModel? Update(RequestBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var request = context.Requests.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (request == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
request.Update(model);
|
||||
context.SaveChanges();
|
||||
request.UpdateOrders(context, model);
|
||||
transaction.Commit();
|
||||
return request.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public RequestViewModel? Delete(RequestBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var request = context.Requests
|
||||
.Include(x => x.Orders)
|
||||
.FirstOrDefault(y => y.Id == model.Id);
|
||||
if (request != null)
|
||||
{
|
||||
context.Requests.Remove(request);
|
||||
context.SaveChanges();
|
||||
return request.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
public bool ConnectRequestAssembly(int requestId, int assemblyId)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var request = context.Requests.FirstOrDefault(x => x.Id == requestId);
|
||||
var assembly = context.Assemblies.FirstOrDefault(x => x.Id == assemblyId);
|
||||
if (request == null || assembly == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
request.ConnectAssembly(context, assemblyId);
|
||||
context.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Implements
|
||||
{
|
||||
//!!!ПОДОБИЕ textile
|
||||
public class ShipmentStorage : IShipmentStorage
|
||||
{
|
||||
public List<ShipmentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
|
||||
return context.Shipments
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//Учитывается id пользователя, создавшего заказ
|
||||
public List<ShipmentViewModel> GetFilteredList(ShipmentSearchModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
//сортировка по дате поставки
|
||||
if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
return context.Shipments
|
||||
.Where(x => (x.UserId == model.UserId) && (x.DateShipment >= model.DateFrom && x.DateShipment <= model.DateTo))
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
//сортировка по поставщику
|
||||
else if (!string.IsNullOrEmpty(model.ProviderName))
|
||||
{
|
||||
return context.Shipments
|
||||
.Where(x => x.ProviderName == model.ProviderName && x.UserId == model.UserId)
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
//возвращение просто всех партий пользователя (замена GetFullList)
|
||||
return context.Shipments
|
||||
.Where(x => x.UserId == model.UserId)
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//Поиск только по id, потому что другие поля не уникальные - нет смысла искать 1 элемент
|
||||
public ShipmentViewModel? GetElement(ShipmentSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Shipments
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public ShipmentViewModel? Insert(ShipmentBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var newShipment = Shipment.Create(context, model);
|
||||
|
||||
if (newShipment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Shipments.Add(newShipment);
|
||||
context.SaveChanges();
|
||||
|
||||
return newShipment.GetViewModel;
|
||||
}
|
||||
|
||||
public ShipmentViewModel? Update(ShipmentBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shipment = context.Shipments.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shipment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
shipment.Update(model);
|
||||
context.SaveChanges();
|
||||
shipment.UpdateOrders(context, model);
|
||||
transaction.Commit();
|
||||
return context.Shipments
|
||||
.Include(x => x.Orders)
|
||||
.ThenInclude(x => x.Order)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//!!!мб по-другому присваивать значение shipment
|
||||
//!!!мб возвращать не просто shipment.getviewmodel
|
||||
public ShipmentViewModel? Delete(ShipmentBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var shipment = context.Shipments.Include(x => x.Orders).FirstOrDefault(y => y.Id == model.Id);
|
||||
if (shipment != null)
|
||||
{
|
||||
context.Shipments.Remove(shipment);
|
||||
context.SaveChanges();
|
||||
return shipment.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.StorageContracts;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDatabaseImplement.Models;
|
||||
using ComputerShopDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Implements
|
||||
{
|
||||
//!!!МБ У USER ХРАНИТЬ СПИСКИ ВСЕХ СОЗДАННЫХ СУШНОСТЕЙ И ТОГДА ПРИ СОЗДАНИИ, УДАЛЕНИИ СУЩНОСТЕЙ ЕЩЁ СОЗДАВАТЬ И УДАЛЯТЬ ИЗ СПИСКА У ПОЛЬЗОВАТЕЛЯ
|
||||
public class UserStorage : IUserStorage
|
||||
{
|
||||
public List<UserViewModel> GetFullList()
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Users.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
//Фильтрация пользователей логически нужна только для роли (по остальным параметрам будет 1 или 0 пользователей)
|
||||
public List<UserViewModel> GetFilteredList(UserSearchModel model)
|
||||
{
|
||||
if (model.Role == null || model.Role == UserRole.Неизвестная)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Users.Where(x => x.Role == model.Role).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
//!!!ПРОВЕРИТЬ
|
||||
//id, почта и логин уникальны, можно получать по ним
|
||||
public UserViewModel? GetElement(UserSearchModel model)
|
||||
{
|
||||
//!!!МБ ЭТУ ПРОВЕРКУ УБРАТЬ
|
||||
if (string.IsNullOrEmpty(model.Login) && string.IsNullOrEmpty(model.Email) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
|
||||
//Поиск пользователя при входе в систему по логину, паролю и его роли (чтобы не могли войти в аккаунты другой роли)
|
||||
if (!string.IsNullOrEmpty(model.Login) && !string.IsNullOrEmpty(model.Password) && model.Role.HasValue)
|
||||
{
|
||||
return context.Users.FirstOrDefault(x => x.Login == model.Login && x.Password == model.Password && x.Role == model.Role)?.GetViewModel;
|
||||
}
|
||||
//!!!НИЖЕ МБ НЕ НАДО
|
||||
//Получение по логину (пользователей с таким логином будет 1 или 0)
|
||||
if (!string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
return context.Users.FirstOrDefault(x => x.Login == model.Login)?.GetViewModel;
|
||||
}
|
||||
//Получение по почте (пользователей с такой почтой будет 1 или 0)
|
||||
else if (!string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return context.Users.FirstOrDefault(x => x.Email == model.Email)?.GetViewModel;
|
||||
}
|
||||
//Получение по id
|
||||
return context.Users.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public UserViewModel? Insert(UserBindingModel model)
|
||||
{
|
||||
var newUser = User.Create(model);
|
||||
if (newUser == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
context.Users.Add(newUser);
|
||||
context.SaveChanges();
|
||||
return newUser.GetViewModel;
|
||||
}
|
||||
|
||||
public UserViewModel? Update(UserBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var user = context.Users.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
user.Update(model);
|
||||
context.SaveChanges();
|
||||
return user.GetViewModel;
|
||||
}
|
||||
|
||||
//!!!МБ И НЕ НУЖЕН
|
||||
public UserViewModel? Delete(UserBindingModel model)
|
||||
{
|
||||
using var context = new ComputerShopDatabase();
|
||||
var user = context.Users.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (user != null)
|
||||
{
|
||||
context.Users.Remove(user);
|
||||
context.SaveChanges();
|
||||
return user.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,452 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerShopDatabase))]
|
||||
[Migration("20240427160810_Первая пробная (Гоша)")]
|
||||
partial class ПерваяпробнаяГоша
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AssemblyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Assemblies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Warranty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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>("ComponentId1")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ComponentId1");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateRequest")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AssemblyId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("RequestOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateShipment")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ProviderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ShipmentId");
|
||||
|
||||
b.ToTable("ShipmentOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("AssemblyComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComponentId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany()
|
||||
.HasForeignKey("AssemblyId");
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Requests")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Shipments")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Shipment", "Shipment")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ShipmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Shipment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Requests");
|
||||
|
||||
b.Navigation("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,338 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ПерваяпробнаяГоша : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Assemblies",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
AssemblyName = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false),
|
||||
Category = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Assemblies", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Components",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentName = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Components", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
Sum = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductName = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false),
|
||||
Warranty = table.Column<int>(type: "integer", nullable: false),
|
||||
ShipmentId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Products", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Role = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AssemblyComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
AssemblyId = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AssemblyComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssemblyComponents_Assemblies_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Assemblies",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssemblyComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentId1 = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductComponents_Components_ComponentId1",
|
||||
column: x => x.ComponentId1,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductComponents_Products_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Requests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
AssemblyId = table.Column<int>(type: "integer", nullable: true),
|
||||
DateRequest = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ClientFIO = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Requests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Requests_Assemblies_AssemblyId",
|
||||
column: x => x.AssemblyId,
|
||||
principalTable: "Assemblies",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Requests_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shipments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProviderName = table.Column<string>(type: "text", nullable: false),
|
||||
DateShipment = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shipments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Shipments_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RequestOrders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RequestId = table.Column<int>(type: "integer", nullable: false),
|
||||
OrderId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RequestOrders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RequestOrders_Orders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "Orders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RequestOrders_Requests_RequestId",
|
||||
column: x => x.RequestId,
|
||||
principalTable: "Requests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShipmentOrders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ShipmentId = table.Column<int>(type: "integer", nullable: false),
|
||||
OrderId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShipmentOrders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShipmentOrders_Orders_OrderId",
|
||||
column: x => x.OrderId,
|
||||
principalTable: "Orders",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShipmentOrders_Shipments_ShipmentId",
|
||||
column: x => x.ShipmentId,
|
||||
principalTable: "Shipments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssemblyComponents_ComponentId",
|
||||
table: "AssemblyComponents",
|
||||
column: "ComponentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductComponents_ComponentId",
|
||||
table: "ProductComponents",
|
||||
column: "ComponentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductComponents_ComponentId1",
|
||||
table: "ProductComponents",
|
||||
column: "ComponentId1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RequestOrders_OrderId",
|
||||
table: "RequestOrders",
|
||||
column: "OrderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RequestOrders_RequestId",
|
||||
table: "RequestOrders",
|
||||
column: "RequestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Requests_AssemblyId",
|
||||
table: "Requests",
|
||||
column: "AssemblyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Requests_UserId",
|
||||
table: "Requests",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShipmentOrders_OrderId",
|
||||
table: "ShipmentOrders",
|
||||
column: "OrderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShipmentOrders_ShipmentId",
|
||||
table: "ShipmentOrders",
|
||||
column: "ShipmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Shipments_UserId",
|
||||
table: "Shipments",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AssemblyComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RequestOrders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShipmentOrders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Requests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shipments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Assemblies");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,519 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerShopDatabase))]
|
||||
[Migration("20240430103035_Внешние ключи (Гоша)")]
|
||||
partial class ВнешниеключиГоша
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AssemblyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Assemblies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Warranty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShipmentId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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>("ComponentId1")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ComponentId1");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateRequest")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AssemblyId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("RequestOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateShipment")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ProviderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ShipmentId");
|
||||
|
||||
b.ToTable("ShipmentOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Assemblies")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("AssemblyComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Shipment", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("ShipmentId");
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Proucts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComponentId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany()
|
||||
.HasForeignKey("AssemblyId");
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany("Requests")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Requests")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany("Shipments")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Shipments")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Shipment", "Shipment")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ShipmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Shipment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Requests");
|
||||
|
||||
b.Navigation("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Assemblies");
|
||||
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("Proucts");
|
||||
|
||||
b.Navigation("Requests");
|
||||
|
||||
b.Navigation("Shipments");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ВнешниеключиГоша : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_ShipmentId",
|
||||
table: "Products",
|
||||
column: "ShipmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_UserId",
|
||||
table: "Products",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_UserId",
|
||||
table: "Orders",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Components_UserId",
|
||||
table: "Components",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Assemblies_UserId",
|
||||
table: "Assemblies",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Assemblies_Users_UserId",
|
||||
table: "Assemblies",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Components_Users_UserId",
|
||||
table: "Components",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Users_UserId",
|
||||
table: "Orders",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Shipments_ShipmentId",
|
||||
table: "Products",
|
||||
column: "ShipmentId",
|
||||
principalTable: "Shipments",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Products_Users_UserId",
|
||||
table: "Products",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Assemblies_Users_UserId",
|
||||
table: "Assemblies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Components_Users_UserId",
|
||||
table: "Components");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Users_UserId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Shipments_ShipmentId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Products_Users_UserId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Products_ShipmentId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Products_UserId",
|
||||
table: "Products");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Orders_UserId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Components_UserId",
|
||||
table: "Components");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Assemblies_UserId",
|
||||
table: "Assemblies");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,516 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ComputerShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(ComputerShopDatabase))]
|
||||
partial class ComputerShopDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AssemblyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Assemblies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.ToTable("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Warranty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShipmentId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.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>("ComponentId1")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("ComponentId1");
|
||||
|
||||
b.ToTable("ProductComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AssemblyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateRequest")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AssemblyId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("RequestOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateShipment")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ProviderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OrderId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShipmentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("ShipmentId");
|
||||
|
||||
b.ToTable("ShipmentOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Assemblies")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("AssemblyComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("Component");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Shipment", null)
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("ShipmentId");
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", null)
|
||||
.WithMany("Proucts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ProductComponent", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComponentId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||
.WithMany()
|
||||
.HasForeignKey("AssemblyId");
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany("Requests")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Assembly");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.RequestOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Requests")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.User", "User")
|
||||
.WithMany("Shipments")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ShipmentOrder", b =>
|
||||
{
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||
.WithMany("Shipments")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ComputerShopDatabaseImplement.Models.Shipment", "Shipment")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ShipmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
b.Navigation("Shipment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("AssemblyComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Navigation("Requests");
|
||||
|
||||
b.Navigation("Shipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Shipment", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Assemblies");
|
||||
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("Proucts");
|
||||
|
||||
b.Navigation("Requests");
|
||||
|
||||
b.Navigation("Shipments");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Models
|
||||
{
|
||||
public class Order : IOrderModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; private set; }
|
||||
|
||||
[Required]
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[Required]
|
||||
public double Sum { get; private set; }
|
||||
|
||||
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<RequestOrder> Requests { get; set; } = new();
|
||||
|
||||
[ForeignKey("OrderId")]
|
||||
public virtual List<ShipmentOrder> Shipments { get; set; } = new();
|
||||
|
||||
public static Order? Create(OrderBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Order()
|
||||
{
|
||||
Id = model.Id,
|
||||
UserId = model.UserId,
|
||||
DateCreate = model.DateCreate,
|
||||
Status = model.Status,
|
||||
Sum = model.Sum,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(OrderBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//DateCreate не обновляю, потому что странно менять дату оформления заказа после его создания
|
||||
Status = model.Status;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
UserId = UserId,
|
||||
DateCreate = DateCreate,
|
||||
Status = Status,
|
||||
Sum = Sum
|
||||
};
|
||||
}
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Models
|
||||
{
|
||||
//!!!МБ У Id сделать private set у ВСЕХ МОИХ МОДЕЛЕЙ
|
||||
public class Request : IRequestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public virtual User User { get; set; }
|
||||
|
||||
public int? AssemblyId { get; set; }
|
||||
|
||||
public virtual Assembly? Assembly { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public DateTime DateRequest { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
private Dictionary<int, IOrderModel>? _requestOrders = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, IOrderModel> RequestOrders
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_requestOrders == null)
|
||||
{
|
||||
_requestOrders = Orders.ToDictionary(x => x.OrderId, x => x.Order as IOrderModel);
|
||||
|
||||
}
|
||||
return _requestOrders;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("RequestId")]
|
||||
public virtual List<RequestOrder> Orders { get; set; } = new();
|
||||
|
||||
|
||||
public static Request Create(ComputerShopDatabase context, RequestBindingModel model)
|
||||
{
|
||||
return new Request() {
|
||||
Id = model.Id,
|
||||
UserId = model.UserId,
|
||||
User = context.Users.First(x => x.Id == model.UserId),
|
||||
AssemblyId = model.AssemblyId,
|
||||
Assembly = model.AssemblyId.HasValue ? context.Assemblies.First(x => x.Id == model.AssemblyId) : null,
|
||||
DateRequest = model.DateRequest,
|
||||
ClientFIO = model.ClientFIO,
|
||||
Orders = model.RequestOrders.Select(x => new RequestOrder
|
||||
{
|
||||
Order = context.Orders.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(RequestBindingModel model)
|
||||
{
|
||||
if (model == null) {
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.ClientFIO))
|
||||
{
|
||||
ClientFIO = model.ClientFIO;
|
||||
}
|
||||
//DateMake не обновляю, потому что странно менять дату оформления заявки после её создания
|
||||
}
|
||||
|
||||
public RequestViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
UserId = UserId,
|
||||
AssemblyId = AssemblyId,
|
||||
Assembly = Assembly,
|
||||
DateRequest = DateRequest,
|
||||
ClientFIO = ClientFIO,
|
||||
RequestOrders = RequestOrders
|
||||
};
|
||||
|
||||
//!!!МБ ПЕРЕДАВАТЬ ЧТО-ТО ДРУГОЕ
|
||||
//!!!ПРОВЕРИТЬ, ЧТО ВСЁ ПРАВИЛЬНО ИЗВЛЕКАЮ
|
||||
public void UpdateOrders(ComputerShopDatabase context, RequestBindingModel model)
|
||||
{
|
||||
var requestOrders = context.RequestOrders.Where(x => x.RequestId == model.Id).ToList();
|
||||
//удаление тех заказов, которых нет в модели
|
||||
if (requestOrders != null && requestOrders.Count > 0)
|
||||
{
|
||||
context.RequestOrders.RemoveRange(requestOrders.Where(x => !model.RequestOrders.ContainsKey(x.OrderId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
//добавление новых заказов
|
||||
var currentRequest = context.Requests.First(x => x.Id == Id);
|
||||
foreach (var request_order in model.RequestOrders)
|
||||
{
|
||||
context.RequestOrders.Add(new RequestOrder
|
||||
{
|
||||
Request = currentRequest,
|
||||
Order = context.Orders.First(x => x.Id == request_order.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_requestOrders = null;
|
||||
}
|
||||
|
||||
//Связывание заявки со сборкой
|
||||
public void ConnectAssembly(ComputerShopDatabase context, int assemblyId)
|
||||
{
|
||||
AssemblyId = assemblyId;
|
||||
Assembly = context.Assemblies.First(x => x.Id == assemblyId);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Models
|
||||
{
|
||||
public class RequestOrder
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int RequestId { get; set; }
|
||||
[Required]
|
||||
public int OrderId { get; set; }
|
||||
public virtual Request Request { get; set; } = new();
|
||||
public virtual Order Order { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Models
|
||||
{
|
||||
public class Shipment : IShipmentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; private set; }
|
||||
|
||||
//!!!мб не нужен (для передачи логина пользователя)
|
||||
public virtual User User { get; set; }
|
||||
|
||||
//!!!МБ ТУТ НЕ НУЖЕН string.Empty
|
||||
[Required]
|
||||
public string ProviderName { get; set; } = string.Empty;
|
||||
|
||||
//!!!МБ ТУТ НЕ НУЖЕН DateTime.Now
|
||||
[Required]
|
||||
public DateTime DateShipment { get; set; } = DateTime.Now;
|
||||
|
||||
//!!!МБ ТУТ КАК-ТО ПО-ДРУГОМУ
|
||||
private Dictionary<int, IOrderModel>? _shipmentOrders = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, IOrderModel> ShipmentOrders
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shipmentOrders == null)
|
||||
{
|
||||
_shipmentOrders = Orders.ToDictionary(x => x.OrderId, x => (x.Order as IOrderModel));
|
||||
}
|
||||
return _shipmentOrders;
|
||||
}
|
||||
}
|
||||
//!!!ПРОВЕРИТЬ, ЧТО ТУТ ПРАВИЛЬНО СДЕЛАНО (ЧТО НАЗВАНИЕ ПРАВИЛЬНОЕ У ВНЕШ. КЛЮЧА, ЧТО ПРАВИЛЬНЫЙ ТИП в <>)
|
||||
[ForeignKey("ShipmentId")]
|
||||
public virtual List<ShipmentOrder> Orders { get; set; } = new();
|
||||
|
||||
[ForeignKey("ShipmentId")]
|
||||
public virtual List<Product> Products { get; set; } = new();
|
||||
|
||||
|
||||
//!!!ПРОВЕРИТЬ, ЧТО ПРАВИЛЬНО ПРИСВАИВАЮ ЗНАЧЕНИЕ СПИСКУ ЗАКАЗОВ
|
||||
public static Shipment Create(ComputerShopDatabase context, ShipmentBindingModel model)
|
||||
{
|
||||
return new Shipment()
|
||||
{
|
||||
Id = model.Id,
|
||||
UserId = model.UserId,
|
||||
User = context.Users.First(x => x.Id == model.UserId),
|
||||
ProviderName = model.ProviderName,
|
||||
DateShipment = model.DateShipment,
|
||||
Orders = model.ShipmentOrders.Select(x => new ShipmentOrder
|
||||
{
|
||||
Order = context.Orders.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
//!!!МБ ТУТ КАКИЕ-ТО ДРУГИЕ ПОЛЯ НАДО БУДЕТ ОБНОВЛЯТЬ
|
||||
public void Update(ShipmentBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.ProviderName))
|
||||
{
|
||||
ProviderName = model.ProviderName;
|
||||
}
|
||||
DateShipment = model.DateShipment;
|
||||
}
|
||||
//!!!МБ ТУТ ЕЩЁ ЧТО-ТО ПРИСВАИВАТЬ
|
||||
public ShipmentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
UserId = UserId,
|
||||
ProviderName = ProviderName,
|
||||
DateShipment = DateShipment,
|
||||
ShipmentOrders = ShipmentOrders
|
||||
};
|
||||
|
||||
//!!!МБ ПЕРЕДАВАТЬ ЧТО-ТО ДРУГОЕ
|
||||
//!!!ПРОВЕРИТЬ, ЧТО ВСЁ ПРАВИЛЬНО ИЗВЛЕКАЮ
|
||||
public void UpdateOrders(ComputerShopDatabase context, ShipmentBindingModel model)
|
||||
{
|
||||
var shipmentOrders = context.ShipmentOrders.Where(x => x.ShipmentId == model.Id).ToList();
|
||||
//удаление тех заказов, которых нет в модели
|
||||
if (shipmentOrders != null && shipmentOrders.Count > 0)
|
||||
{
|
||||
context.ShipmentOrders.RemoveRange(shipmentOrders.Where(x => !model.ShipmentOrders.ContainsKey(x.OrderId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
//добавление новых заказов
|
||||
var currentShipment = context.Shipments.First(x => x.Id == Id);
|
||||
foreach (var shipment_order in model.ShipmentOrders)
|
||||
{
|
||||
context.ShipmentOrders.Add(new ShipmentOrder
|
||||
{
|
||||
Shipment = currentShipment,
|
||||
Order = context.Orders.First(x => x.Id == shipment_order.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_shipmentOrders = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ComputerShopDatabaseImplement.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-связь партии товаров и заказа
|
||||
/// </summary>
|
||||
public class ShipmentOrder
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ShipmentId { get; set; }
|
||||
[Required]
|
||||
public int OrderId { get; set; }
|
||||
|
||||
public virtual Shipment Shipment { get; set; } = new();
|
||||
public virtual Order Order { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopDataModels.Enums;
|
||||
using ComputerShopDataModels.Models;
|
||||
using ComputerShopDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -22,59 +18,8 @@ namespace ComputerShopDatabaseImplement.Models
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
//!!!МБ ТУТ НУЖНА ДОП. АННОТАЦИЯ ПРОВЕРКИ ПОЧТЫ
|
||||
[Required]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public UserRole Role { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Shipment> Shipments { get; set; } = new();
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Request> Requests { get; set; } = new();
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Assembly> Assemblies { get; set; } = new();
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Component> Components { get; set; } = new();
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Product> Proucts { get; set; } = new();
|
||||
|
||||
|
||||
public static User Create(UserBindingModel model)
|
||||
{
|
||||
return new User
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
Password = model.Password,
|
||||
Email = model.Email,
|
||||
Role = model.Role
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(UserBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
Password = model.Password;
|
||||
Email = model.Email;
|
||||
}
|
||||
|
||||
//!!!МБ ТУТ НЕ НАДО РОЛЬ
|
||||
public UserViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
Email = Email,
|
||||
Role = Role
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace ComputerShopImplementerApp
|
||||
{
|
||||
//!!!мб тут оставить всё, как client (заново перекопировать файл)
|
||||
public class APIUser
|
||||
{
|
||||
private static readonly HttpClient _user = new();
|
||||
|
||||
public static UserViewModel? User { get; set; } = null;
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_user.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||
_user.DefaultRequestHeaders.Accept.Clear();
|
||||
_user.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _user.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _user.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
//!!!МБ ДОБАВИТЬ DeleteRequest
|
||||
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,148 +0,0 @@
|
||||
using ComputerShopImplementerApp.Models;
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputerShopImplementerApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(/*APIUser.GetRequest<List<OrderViewModel>>($"api/main/getorders?userId={APIUser.User.Id}")*/);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIUser.User);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string email)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("Вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и почту");
|
||||
}
|
||||
APIUser.PostRequest("api/user/updatedata", new UserBindingModel
|
||||
{
|
||||
Id = APIUser.User.Id,
|
||||
Login = login,
|
||||
Password = password,
|
||||
Email = email
|
||||
});
|
||||
|
||||
APIUser.User.Login = login;
|
||||
APIUser.User.Password = password;
|
||||
APIUser.User.Email = email;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIUser.User = APIUser.GetRequest<UserViewModel>($"api/user/loginimplementer?login={login}&password={password}");
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и почту");
|
||||
}
|
||||
APIUser.PostRequest("api/user/registerimplementer", new UserBindingModel
|
||||
{
|
||||
Login = login,
|
||||
Password = password,
|
||||
Email = email
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
//!!!Сделать что-то похожее
|
||||
//[HttpGet]
|
||||
//public IActionResult Create()
|
||||
//{
|
||||
// ViewBag.Textiles = APIUser.GetRequest<List<TextileViewModel>>("api/main/gettextilelist");
|
||||
// return View();
|
||||
//}
|
||||
|
||||
//[HttpPost]
|
||||
//public void Create(int Textile, int count)
|
||||
//{
|
||||
// if (APIUser.User == null)
|
||||
// {
|
||||
// throw new Exception("Вход только авторизованным");
|
||||
// }
|
||||
// if (count <= 0)
|
||||
// {
|
||||
// throw new Exception("Количество и сумма должны быть больше 0");
|
||||
// }
|
||||
// APIUser.PostRequest("api/main/createorder", new OrderBindingModel
|
||||
// {
|
||||
// UserId = APIUser.User.Id,
|
||||
// TextileId = Textile,
|
||||
// Count = count,
|
||||
// Sum = Calc(count, Textile)
|
||||
// });
|
||||
// Response.Redirect("Index");
|
||||
//}
|
||||
|
||||
//[HttpPost]
|
||||
//public double Calc(int count, int textile)
|
||||
//{
|
||||
// var _textile = APIUser.GetRequest<TextileViewModel>($"api/main/gettextile?textileId={textile}");
|
||||
// return count * (_textile?.Price ?? 1);
|
||||
//}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace ComputerShopImplementerApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
using ComputerShopImplementerApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
APIUser.Connect(builder.Configuration);
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
||||
|
@ -1,28 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:34894",
|
||||
"sslPort": 44330
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"ComputerShopImplementerApp": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7049;http://localhost:5024",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
@{
|
||||
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 btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,8 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
@ -1,30 +0,0 @@
|
||||
@using ComputerShopContracts.ViewModels
|
||||
|
||||
@model UserViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<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" value="@Model.Login" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8"><input type="password" name="password" value="@Model.Password" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Почта:</div>
|
||||
<div class="col-8"><input type="text" name="email" value="@Model.Email" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
@{
|
||||
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="email" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,25 +0,0 @@
|
||||
@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>
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - GarmentFactoryClientApp</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>
|
||||
</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">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">"Ты ж программист"</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-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 flex-sm-row-reverse">
|
||||
<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">Заказы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" 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 - Сайт магазина компьютерной техники "Ты ж программист" для исполнителя - <a asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,48 +0,0 @@
|
||||
/* 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;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
@ -1,3 +0,0 @@
|
||||
@using ComputerShopImplementerApp
|
||||
@using ComputerShopImplementerApp.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@ -1,3 +0,0 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IPAddress": "http://localhost:5055/"
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB |
@ -1,4 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// Write your JavaScript code.
|
@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2021 Twitter, Inc.
|
||||
Copyright (c) 2011-2021 The Bootstrap Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,427 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:root {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--bs-body-font-family);
|
||||
font-size: var(--bs-body-font-size);
|
||||
font-weight: var(--bs-body-font-weight);
|
||||
line-height: var(--bs-body-line-height);
|
||||
color: var(--bs-body-color);
|
||||
text-align: var(--bs-body-text-align);
|
||||
background-color: var(--bs-body-bg);
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
color: inherit;
|
||||
background-color: currentColor;
|
||||
border: 0;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
hr:not([size]) {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
h6, h5, h4, h3, h2, h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: calc(1.325rem + 0.9vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: calc(1.3rem + 0.6vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h3 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title],
|
||||
abbr[data-bs-original-title] {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0.2em;
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0d6efd;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
color: #0a58ca;
|
||||
}
|
||||
|
||||
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 1em;
|
||||
direction: ltr /* rtl:ignore */;
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
pre code {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.875em;
|
||||
color: #d63384;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
a > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 0.2rem 0.4rem;
|
||||
font-size: 0.875em;
|
||||
color: #fff;
|
||||
background-color: #212529;
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
kbd kbd {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
caption-side: bottom;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
color: #6c757d;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody,
|
||||
tfoot,
|
||||
tr,
|
||||
td,
|
||||
th {
|
||||
border-color: inherit;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus:not(:focus-visible) {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
[role=button] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
select:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
[list]::-webkit-calendar-picker-indicator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button,
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
button:not(:disabled),
|
||||
[type=button]:not(:disabled),
|
||||
[type=reset]:not(:disabled),
|
||||
[type=submit]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
float: left;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
line-height: inherit;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
legend {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
legend + * {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
::-webkit-datetime-edit-fields-wrapper,
|
||||
::-webkit-datetime-edit-text,
|
||||
::-webkit-datetime-edit-minute,
|
||||
::-webkit-datetime-edit-hour-field,
|
||||
::-webkit-datetime-edit-day-field,
|
||||
::-webkit-datetime-edit-month-field,
|
||||
::-webkit-datetime-edit-year-field {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
outline-offset: -2px;
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
|
||||
/* rtl:raw:
|
||||
[type="tel"],
|
||||
[type="url"],
|
||||
[type="email"],
|
||||
[type="number"] {
|
||||
direction: ltr;
|
||||
}
|
||||
*/
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
File diff suppressed because one or more lines are too long
@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
|
||||
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
|
File diff suppressed because one or more lines are too long
@ -1,424 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:root {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--bs-body-font-family);
|
||||
font-size: var(--bs-body-font-size);
|
||||
font-weight: var(--bs-body-font-weight);
|
||||
line-height: var(--bs-body-line-height);
|
||||
color: var(--bs-body-color);
|
||||
text-align: var(--bs-body-text-align);
|
||||
background-color: var(--bs-body-bg);
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
color: inherit;
|
||||
background-color: currentColor;
|
||||
border: 0;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
hr:not([size]) {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
h6, h5, h4, h3, h2, h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: calc(1.325rem + 0.9vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: calc(1.3rem + 0.6vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h3 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title],
|
||||
abbr[data-bs-original-title] {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5rem;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0.2em;
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0d6efd;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
color: #0a58ca;
|
||||
}
|
||||
|
||||
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 1em;
|
||||
direction: ltr ;
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
pre code {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.875em;
|
||||
color: #d63384;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
a > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 0.2rem 0.4rem;
|
||||
font-size: 0.875em;
|
||||
color: #fff;
|
||||
background-color: #212529;
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
kbd kbd {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
caption-side: bottom;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
color: #6c757d;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody,
|
||||
tfoot,
|
||||
tr,
|
||||
td,
|
||||
th {
|
||||
border-color: inherit;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus:not(:focus-visible) {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
[role=button] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
select:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
[list]::-webkit-calendar-picker-indicator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button,
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
button:not(:disabled),
|
||||
[type=button]:not(:disabled),
|
||||
[type=reset]:not(:disabled),
|
||||
[type=submit]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
float: right;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
line-height: inherit;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
legend {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
legend + * {
|
||||
clear: right;
|
||||
}
|
||||
|
||||
::-webkit-datetime-edit-fields-wrapper,
|
||||
::-webkit-datetime-edit-text,
|
||||
::-webkit-datetime-edit-minute,
|
||||
::-webkit-datetime-edit-hour-field,
|
||||
::-webkit-datetime-edit-day-field,
|
||||
::-webkit-datetime-edit-month-field,
|
||||
::-webkit-datetime-edit-year-field {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
outline-offset: -2px;
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
|
||||
[type="tel"],
|
||||
[type="url"],
|
||||
[type="email"],
|
||||
[type="number"] {
|
||||
direction: ltr;
|
||||
}
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */
|
File diff suppressed because one or more lines are too long
@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
|
||||
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user