fix relation in DatabaseImplement, some implements in StorekeeperApp

This commit is contained in:
DavidMakarov 2024-05-28 17:09:34 +04:00
parent 45b70d2f5c
commit b31646b7a8
33 changed files with 271 additions and 70 deletions

View File

@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace FactoryBuisinessLogic.BusinessLogics namespace FactoryBusinessLogic.BusinessLogics
{ {
public class MachineLogic : IMachineLogic public class MachineLogic : IMachineLogic
{ {
@ -33,7 +33,19 @@ namespace FactoryBuisinessLogic.BusinessLogics
return list; return list;
} }
public MachineViewModel? ReadElement(MachineSearchModel model) public List<MachineViewModel>? ReadListByIds(List<int> ids)
{
_logger.LogInformation("ReadListByIds.");
var list = _machineStorage.GetListByIds(ids);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadListByIds. Count:{Count}", list.Count);
return list;
}
public MachineViewModel? ReadElement(MachineSearchModel model)
{ {
if (model == null) if (model == null)
{ {

View File

@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace FactoryBuisinessLogic.BusinessLogics namespace FactoryBusinessLogic.BusinessLogics
{ {
public class ProductLogic : IProductLogic public class ProductLogic : IProductLogic
{ {

View File

@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace FactoryBuisinessLogic.BusinessLogics namespace FactoryBusinessLogic.BusinessLogics
{ {
public class RequirementLogic : IRequirementLogic public class RequirementLogic : IRequirementLogic
{ {

View File

@ -4,7 +4,7 @@ using FactoryContracts.SearchModels;
using FactoryContracts.StoragesContracts; using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
namespace FactoryBuisinessLogic.BusinessLogics namespace FactoryBusinessLogic.BusinessLogics
{ {
public class StorekeeperReportLogic : IStorekeeperReportLogic public class StorekeeperReportLogic : IStorekeeperReportLogic
{ {

View File

@ -4,7 +4,7 @@ using FactoryContracts.SearchModels;
using FactoryContracts.StoragesContracts; using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
namespace FactoryBuisinessLogic.BusinessLogics namespace FactoryBusinessLogic.BusinessLogics
{ {
public class WorkerReportLogic : IWorkerReportLogic public class WorkerReportLogic : IWorkerReportLogic
{ {

View File

@ -11,7 +11,7 @@ namespace FactoryContracts.BindingModels
public string ImplementerFIO { get; set; } = string.Empty; public string ImplementerFIO { get; set; } = string.Empty;
public ExecutionPhaseStatus Status { get; set; } = ExecutionPhaseStatus.Неизвестен; public ExecutionPhaseStatus Status { get; set; } = ExecutionPhaseStatus.Неизвестен;
public int ClientId { get; set; } public int ClientId { get; set; }
public int? PlanProductionId { get; set; } public int PlanProductionId { get; set; }
} }

View File

@ -8,7 +8,9 @@ namespace FactoryContracts.BusinessLogicsContracts
{ {
List<MachineViewModel>? ReadList(MachineSearchModel? model); List<MachineViewModel>? ReadList(MachineSearchModel? model);
MachineViewModel? ReadElement(MachineSearchModel model); List<MachineViewModel>? ReadListByIds(List<int> ids);
MachineViewModel? ReadElement(MachineSearchModel model);
bool Create(MachineBindingModel model); bool Create(MachineBindingModel model);

View File

@ -10,7 +10,9 @@ namespace FactoryContracts.StoragesContracts
List<MachineViewModel> GetFilteredList(MachineSearchModel model); List<MachineViewModel> GetFilteredList(MachineSearchModel model);
List<MachinePeriodReportViewModel> GetMachinesByPeriod(ClientSearchModel client, ReportBindingModel model); List<MachineViewModel> GetListByIds(List<int> ids);
List<MachinePeriodReportViewModel> GetMachinesByPeriod(ClientSearchModel client, ReportBindingModel model);
MachineViewModel? GetElement(MachineSearchModel model); MachineViewModel? GetElement(MachineSearchModel model);

View File

@ -9,7 +9,7 @@ namespace FactoryContracts.ViewModels
public int Id { get; set; } public int Id { get; set; }
public int ClientId { get; set; } public int ClientId { get; set; }
public int? PlanProductionId { get; set; } public int PlanProductionId { get; set; }
[DisplayName("ФИО исполнителя")] [DisplayName("ФИО исполнителя")]
public string ImplementerFIO { get; set; } = string.Empty; public string ImplementerFIO { get; set; } = string.Empty;

View File

@ -9,6 +9,6 @@ namespace FactoryDataModels.Models
string ImplementerFIO { get; } string ImplementerFIO { get; }
ExecutionPhaseStatus Status { get; } ExecutionPhaseStatus Status { get; }
int ClientId { get; } int ClientId { get; }
int? PlanProductionId { get; } int PlanProductionId { get; }
} }
} }

View File

@ -9,7 +9,8 @@
double Cost { get; } double Cost { get; }
int ClientId { get; } int ClientId { get; }
DateTime DateCreate { get; }
Dictionary<int, (IProductModel, int)> WorkpieceProducts { get; } Dictionary<int, (IProductModel, int)> WorkpieceProducts { get; }
} }
} }

View File

@ -23,8 +23,4 @@
<ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" /> <ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project> </Project>

View File

@ -42,7 +42,19 @@ namespace FactoryDatabaseImplement.Implements
.ToList(); .ToList();
} }
public MachineViewModel? GetElement(MachineSearchModel model) public List<MachineViewModel> GetListByIds(List<int> ids)
{
using var context = new FactoryDatabase();
return context.Machines
.Include(x => x.Client)
.Include (x => x.PlanProductions)
.ThenInclude (x => x.PlanProduction)
.Where(x => ids.Any(y => x.Id == y))
.Select(x => x.GetViewModel)
.ToList();
}
public MachineViewModel? GetElement(MachineSearchModel model)
{ {
if (string.IsNullOrEmpty(model.MachineName) && !model.Id.HasValue) if (string.IsNullOrEmpty(model.MachineName) && !model.Id.HasValue)
{ {

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace FactoryDatabaseImplement.Migrations namespace FactoryDatabaseImplement.Migrations
{ {
[DbContext(typeof(FactoryDatabase))] [DbContext(typeof(FactoryDatabase))]
[Migration("20240528111521_InitCreate")] [Migration("20240528130831_InitCreate")]
partial class InitCreate partial class InitCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -71,8 +71,7 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("PlanProductionId") b.Property<int>("PlanProductionId")
.IsRequired()
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")

View File

@ -69,8 +69,7 @@ namespace FactoryDatabaseImplement.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("PlanProductionId") b.Property<int>("PlanProductionId")
.IsRequired()
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Status") b.Property<int>("Status")

View File

@ -12,11 +12,11 @@ namespace FactoryDatabaseImplement.Models
public int Id { get; private set; } public int Id { get; private set; }
[Required] [Required]
public int ClientId { get; private set; } public int ClientId { get; private set; }
public virtual Client Client { get; private set; } = new(); public virtual Client Client { get; private set; }
[Required] [Required]
public int? PlanProductionId { get; private set; } public int PlanProductionId { get; private set; }
public virtual PlanProduction PlanProduction { get; private set; } = new(); public virtual PlanProduction PlanProduction { get; private set; }
[Required] [Required]
public string ExecutionPhaseName { get; private set; } = string.Empty; public string ExecutionPhaseName { get; private set; } = string.Empty;

View File

@ -13,7 +13,7 @@ namespace FactoryDatabaseImplement.Models
[Required] [Required]
public int ClientId { get; private set; } public int ClientId { get; private set; }
public virtual Client Client { get; private set; } = new(); public virtual Client Client { get; private set; }
[Required] [Required]
public string MachineName { get; private set; } = string.Empty; public string MachineName { get; private set; } = string.Empty;

View File

@ -15,8 +15,8 @@ namespace FactoryDatabaseImplement.Models
[Required] [Required]
public int Count { get; set; } public int Count { get; set; }
public virtual PlanProduction PlanProduction { get; set; } = new(); public virtual PlanProduction PlanProduction { get; set; }
public virtual Machine Machine { get; set; } = new(); public virtual Machine Machine { get; set; }
} }
} }

View File

@ -13,12 +13,12 @@ namespace FactoryDatabaseImplement.Models
[Required] [Required]
public int ClientId { get; private set; } public int ClientId { get; private set; }
public virtual Client Client { get; private set; } = new(); public virtual Client Client { get; private set; }
[Required] [Required]
public int RequirementId { get; private set; } public int RequirementId { get; private set; }
public virtual Requirement Requirement { get; private set; } = new(); public virtual Requirement Requirement { get; private set; }
[Required] [Required]
public string ProductName { get; private set; } = string.Empty; public string ProductName { get; private set; } = string.Empty;

View File

@ -13,7 +13,7 @@ namespace FactoryDatabaseImplement.Models
[Required] [Required]
public int ClientId { get; private set; } public int ClientId { get; private set; }
public virtual Client Client { get; private set; } = new(); public virtual Client Client { get; private set; }
[Required] [Required]
public string RequirementName { get; private set; } = string.Empty; public string RequirementName { get; private set; } = string.Empty;
@ -25,7 +25,7 @@ namespace FactoryDatabaseImplement.Models
public int Lifetime { get; private set; } public int Lifetime { get; private set; }
[ForeignKey("RequirementId")] [ForeignKey("RequirementId")]
public virtual Product Product { get; private set; } = new(); public virtual Product Product { get; private set; }
public static Requirement Create(RequirementBindingModel model) public static Requirement Create(RequirementBindingModel model)
{ {

View File

@ -14,7 +14,7 @@ namespace FactoryDatabaseImplement.Models
public string WorkpieceName { get; set; } = string.Empty; public string WorkpieceName { get; set; } = string.Empty;
[Required] [Required]
public int ClientId { get; set; } public int ClientId { get; set; }
public virtual Client Client { get; set; } = new Client(); public virtual Client Client { get; set; }
[Required] [Required]
public string Material { get; set; } = string.Empty; public string Material { get; set; } = string.Empty;

View File

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace FactoryRestApi.Controllers
{
public class StorekeeperController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65510",
"sslPort": 44345
}
},
"profiles": {
"FactoryRestApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7230;http://localhost:5003",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@ -0,0 +1,9 @@
using FactoryContracts.ViewModels;
namespace FactoryStorekeeperApp
{
public static class Client
{
public static ClientViewModel? client { get; set; }
}
}

View File

@ -2,6 +2,7 @@
using FactoryContracts.BusinessLogicsContracts; using FactoryContracts.BusinessLogicsContracts;
using FactoryContracts.SearchModels; using FactoryContracts.SearchModels;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
using FactoryDataModels.Enums;
using FactoryDataModels.Models; using FactoryDataModels.Models;
using FactoryStorekepeerApp.Models; using FactoryStorekepeerApp.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -12,13 +13,18 @@ namespace FactoryStorekeeperApp.Controllers
public class HomeController : Controller public class HomeController : Controller
{ {
private readonly ILogger<HomeController> _logger; private readonly ILogger<HomeController> _logger;
private readonly IClientLogic clientLogic;
private readonly IMachineLogic machineLogic; private readonly IMachineLogic machineLogic;
private readonly IRequirementLogic requirementLogic; private readonly IRequirementLogic requirementLogic;
private readonly IProductLogic productLogic; private readonly IProductLogic productLogic;
public HomeController(ILogger<HomeController> logger, IRequirementLogic requirementLogic, IProductLogic productLogic, IMachineLogic machineLogic) private bool IsLoggedIn { get { return Client.client != null; } }
private int UserId { get { return Client.client!.Id; } }
public HomeController(ILogger<HomeController> logger, IClientLogic clientLogic, IRequirementLogic requirementLogic, IProductLogic productLogic, IMachineLogic machineLogic)
{ {
_logger = logger; _logger = logger;
this.clientLogic = clientLogic;
this.requirementLogic = requirementLogic; this.requirementLogic = requirementLogic;
this.productLogic = productLogic; this.productLogic = productLogic;
this.machineLogic = machineLogic; this.machineLogic = machineLogic;
@ -26,6 +32,10 @@ namespace FactoryStorekeeperApp.Controllers
public IActionResult Index() public IActionResult Index()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(); return View();
} }
@ -38,32 +48,78 @@ namespace FactoryStorekeeperApp.Controllers
[HttpGet] [HttpGet]
public IActionResult Enter() public IActionResult Enter()
{ {
if (IsLoggedIn)
{
return Redirect("~/Home/Index");
}
return View();
}
[HttpPost]
public IActionResult Enter(string login, string password)
{
var existsClient = clientLogic.ReadElement(new ClientSearchModel { Login = login, Password = password });
if (existsClient != null)
{
Client.client = existsClient;
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Register() public IActionResult Register()
{ {
if (IsLoggedIn)
{
return Redirect("~/Home/Index");
}
return View(); return View();
} }
[HttpPost]
public IActionResult Register(string login, string email, string password, string passwordConfirm)
{
if (!password.Equals(passwordConfirm))
{
return Error();
}
clientLogic.Create(new ClientBindingModel
{
Email = email,
Login = login,
Password = password,
Role = ClientRole.Кладовщик
});
return Redirect("~/Home/Index");
}
[HttpGet] [HttpGet]
public IActionResult Machines() public IActionResult Machines()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(machineLogic.ReadList(null)); return View(machineLogic.ReadList(null));
} }
[HttpGet] [HttpGet]
public IActionResult Machine() public IActionResult Machine()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(); return View();
} }
[HttpPost] [HttpPost]
public void Machine(string machinename, DateTime exploitationstartdate, int lifetime) public IActionResult Machine(string machinename, DateTime exploitationstartdate, int lifetime)
{ {
var element = machineLogic.ReadElement(new MachineSearchModel var element = machineLogic.ReadElement(new MachineSearchModel
{ {
MachineName = machinename, MachineName = machinename,
ClientId = Client.client.Id,
}); });
if (element == null) { if (element == null) {
machineLogic.Create(new MachineBindingModel machineLogic.Create(new MachineBindingModel
@ -71,6 +127,7 @@ namespace FactoryStorekeeperApp.Controllers
MachineName = machinename, MachineName = machinename,
ExploitationStartDate = exploitationstartdate, ExploitationStartDate = exploitationstartdate,
Lifetime = lifetime, Lifetime = lifetime,
ClientId = Client.client.Id,
}); });
} }
else else
@ -80,36 +137,48 @@ namespace FactoryStorekeeperApp.Controllers
MachineName = machinename, MachineName = machinename,
ExploitationStartDate = exploitationstartdate, ExploitationStartDate = exploitationstartdate,
Lifetime = lifetime, Lifetime = lifetime,
}); ClientId = Client.client.Id,
});
} }
Redirect("~/Home/Machines"); return Redirect("~/Home/Machines");
} }
[HttpGet] [HttpGet]
public IActionResult Products() public IActionResult Products()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(productLogic.ReadList(null)); return View(productLogic.ReadList(null));
} }
[HttpGet] [HttpGet]
public IActionResult Product() public IActionResult Product()
{ {
if (!IsLoggedIn)
{
return Enter();
}
return View(machineLogic.ReadList(null)); return View(machineLogic.ReadList(null));
} }
[HttpPost] [HttpPost]
public void Product(string productname, int price, List<MachineViewModel> machinetable) public void Product(string productname, int price, List<int> machines)
{ {
var element = productLogic.ReadElement(new ProductSearchModel var element = productLogic.ReadElement(new ProductSearchModel
{ {
ProductName = productname, ProductName = productname,
}); ClientId = Client.client.Id,
});
var machineList = machineLogic.ReadListByIds(machines);
if (element == null) if (element == null)
{ {
productLogic.Create(new ProductBindingModel productLogic.Create(new ProductBindingModel
{ {
ProductName = productname, ProductName = productname,
Price = price, Price = price,
ProductMachines = machinetable.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel), ProductMachines = machineList.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
}); ClientId = Client.client.Id,
});
} }
else else
{ {
@ -117,32 +186,49 @@ namespace FactoryStorekeeperApp.Controllers
{ {
ProductName = productname, ProductName = productname,
Price = price, Price = price,
ProductMachines = machinetable.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel), ProductMachines = machineList.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
}); ClientId = Client.client.Id,
});
} }
Redirect("~/Home/Products"); Redirect("~/Home/Products");
} }
[HttpGet] [HttpGet]
public IActionResult Requirements() public IActionResult Requirements()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(requirementLogic.ReadList(null)); return View(requirementLogic.ReadList(null));
} }
[HttpGet] [HttpGet]
public IActionResult Requirement() public IActionResult Requirement()
{ {
if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View(); return View();
} }
[HttpGet] [HttpGet]
public IActionResult Reports() public IActionResult Reports()
{ {
return View(); if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
return View();
} }
[HttpGet] [HttpGet]
public IActionResult MachinePeriodReport() public IActionResult MachinePeriodReport()
{ {
List<MachinePeriodReportViewModel> reports = new List<MachinePeriodReportViewModel> if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
List<MachinePeriodReportViewModel> reports = new List<MachinePeriodReportViewModel>
{ {
new MachinePeriodReportViewModel new MachinePeriodReportViewModel
{ {
@ -163,7 +249,11 @@ namespace FactoryStorekeeperApp.Controllers
[HttpGet] [HttpGet]
public IActionResult PlanProductionByProductReport() public IActionResult PlanProductionByProductReport()
{ {
List<ProductPlanProductionReportViewModel> productPlanProductions = new List<ProductPlanProductionReportViewModel> if (!IsLoggedIn)
{
return Redirect("~/Home/Enter");
}
List<ProductPlanProductionReportViewModel> productPlanProductions = new List<ProductPlanProductionReportViewModel>
{ {
new ProductPlanProductionReportViewModel new ProductPlanProductionReportViewModel
{ {

View File

@ -1,4 +1,4 @@
using FactoryBuisinessLogic.BusinessLogics; using FactoryBusinessLogic.BusinessLogics;
using FactoryContracts.BusinessLogicsContracts; using FactoryContracts.BusinessLogicsContracts;
using FactoryContracts.StoragesContracts; using FactoryContracts.StoragesContracts;
using FactoryDatabaseImplement.Implements; using FactoryDatabaseImplement.Implements;
@ -6,17 +6,17 @@ using FactoryDatabaseImplement.Implements;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IMachineLogic, MachineLogic>(); builder.Services.AddTransient<IMachineLogic, MachineLogic>();
builder.Services.AddTransient<IProductLogic, ProductLogic>(); builder.Services.AddTransient<IProductLogic, ProductLogic>();
builder.Services.AddTransient<IRequirementLogic, RequirementLogic>(); builder.Services.AddTransient<IRequirementLogic, RequirementLogic>();
builder.Services.AddTransient<IStorekeeperReportLogic, StorekeeperReportLogic>(); builder.Services.AddTransient<IStorekeeperReportLogic, StorekeeperReportLogic>();
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IMachineStorage, MachineStorage>(); builder.Services.AddTransient<IMachineStorage, MachineStorage>();
builder.Services.AddTransient<IProductStorage, ProductStorage>(); builder.Services.AddTransient<IProductStorage, ProductStorage>();
builder.Services.AddTransient<IRequirementStorage, RequirementStorage>(); builder.Services.AddTransient<IRequirementStorage, RequirementStorage>();
//builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
builder.Services.AddControllersWithViews(); builder.Services.AddControllersWithViews();
var app = builder.Build(); var app = builder.Build();

View File

@ -14,27 +14,9 @@
<div class="col-4">Цена:</div> <div class="col-4">Цена:</div>
<div class="col-8"><input type="number" id="price" name="price"/></div> <div class="col-8"><input type="number" id="price" name="price"/></div>
</div> </div>
<div class="table-responsive-sm"> <div class="row">
<div class="col-4">Станки:</div> <div class="col-4">Станки:</div>
<table id="machinetable" class="table"> <select id="machines" name="machines" class="form-control border border-dark rounded" multiple size="5" asp-items="@(new SelectList(Model, "Id", "MachineName"))"></select>
<thead>
<tr>
<th></th>
<th>Название</th>
</tr>
</thead>
<tbody>
@foreach (var machine in Model)
{
<tr>
<td>
<input type="checkbox" id="machines" name="machines" value="@machine.Id" />
</td>
<td>@machine.MachineName</td>
</tr>
}
</tbody>
</table>
</div> </div>
<div class="row"> <div class="row">
<div class="col-8"></div> <div class="col-8"></div>

View File

@ -1,6 +1,5 @@
using FactoryContracts.BusinessLogicsContracts; using FactoryContracts.BusinessLogicsContracts;
using FactoryBusinessLogic.BusinessLogics; using FactoryBusinessLogic.BusinessLogics;
using FactoryBuisinessLogic.BusinessLogics;
using FactoryContracts.StoragesContracts; using FactoryContracts.StoragesContracts;
using FactoryDatabaseImplement.Implements; using FactoryDatabaseImplement.Implements;
using FactoryWorkerApp; using FactoryWorkerApp;