Update BusinessLogic and some storages #1
@ -10,5 +10,6 @@ namespace Contracts.SearchModels
|
|||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Login { get; set; }
|
public string? Login { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="log4net" Version="2.0.17" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.29" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.29" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.29" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.29" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.29">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.29">
|
||||||
|
@ -22,7 +22,7 @@ namespace DatabaseImplement.Implements
|
|||||||
public DetailViewModel? GetElement(DetailSearchModel model)
|
public DetailViewModel? GetElement(DetailSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new FactoryGoWorkDatabase();
|
using var context = new FactoryGoWorkDatabase();
|
||||||
return context.Details.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Contains(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
return context.Details.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Equals(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DetailViewModel> GetFilteredList(DetailSearchModel model)
|
public List<DetailViewModel> GetFilteredList(DetailSearchModel model)
|
||||||
@ -35,7 +35,7 @@ namespace DatabaseImplement.Implements
|
|||||||
if (model.DateFrom.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
return context.Details.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList();
|
return context.Details.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList();
|
||||||
else
|
else
|
||||||
return context.Details.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
return context.Details.Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace DatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Login)) { return null; }
|
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Login)) { return null; }
|
||||||
using var context = new FactoryGoWorkDatabase();
|
using var context = new FactoryGoWorkDatabase();
|
||||||
return context.Implementers.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) || (!string.IsNullOrEmpty(model.Login) && x.Login.Equals(model.Login)))?.GetViewModel; ;
|
return context.Implementers.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id) || (!string.IsNullOrEmpty(model.Login) && !string.IsNullOrEmpty(model.Password) && x.Login.Equals(model.Login) && x.Password.Equals(model.Password)))?.GetViewModel; ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
|
@ -39,7 +39,7 @@ namespace DatabaseImplement.Implements
|
|||||||
else if (model.WorkerId.HasValue)
|
else if (model.WorkerId.HasValue)
|
||||||
return context.Products.Where(p => p.MachineId.HasValue).Include(p => p.Machine).ThenInclude(p => p.Workers).Where(x => x.Machine.Workers.FirstOrDefault(y => y.WorkerId == model.WorkerId) != null).Select(x => x.GetViewModel).ToList();
|
return context.Products.Where(p => p.MachineId.HasValue).Include(p => p.Machine).ThenInclude(p => p.Workers).Where(x => x.Machine.Workers.FirstOrDefault(y => y.WorkerId == model.WorkerId) != null).Select(x => x.GetViewModel).ToList();
|
||||||
else
|
else
|
||||||
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
|
return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProductViewModel> GetFullList()
|
public List<ProductViewModel> GetFullList()
|
||||||
|
13
Course/ImplemenerLogic/DataToLogic.cs
Normal file
13
Course/ImplemenerLogic/DataToLogic.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using DatabaseImplement.Implements;
|
||||||
|
using BusinessLogic.BusinessLogic;
|
||||||
|
|
||||||
|
namespace ImplemenerLogic
|
||||||
|
{
|
||||||
|
public static class DataToLogic
|
||||||
|
{
|
||||||
|
public static DetailLogic detailLogic()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
Course/ImplemenerLogic/ImplemenerLogic.csproj
Normal file
14
Course/ImplemenerLogic/ImplemenerLogic.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
|
||||||
|
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -5,82 +5,119 @@ using BusinessLogic.BusinessLogic;
|
|||||||
using Contracts.BusinessLogicsContracts;
|
using Contracts.BusinessLogicsContracts;
|
||||||
using Contracts.ViewModels;
|
using Contracts.ViewModels;
|
||||||
using DataModels.Models;
|
using DataModels.Models;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
|
||||||
namespace ImplementerApp.Controllers
|
namespace ImplementerApp.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly IDetailLogic _detailLogic;
|
private readonly ImplementerData _data;
|
||||||
private readonly IImplementerLogic _userLogic;
|
public HomeController(ILogger<HomeController> logger, ImplementerData data)
|
||||||
private readonly IProductLogic _productLogic;
|
|
||||||
private readonly IProductionLogic _productionLogic;
|
|
||||||
|
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_data = data;
|
||||||
|
}
|
||||||
|
public IActionResult IndexNonReg()
|
||||||
|
{
|
||||||
|
if (UserImplementer.user == null)
|
||||||
|
return View();
|
||||||
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
|
if (UserImplementer.user == null)
|
||||||
|
return RedirectToAction("IndexNonReg");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Enter()
|
public IActionResult Enter()
|
||||||
{
|
{
|
||||||
|
if (UserImplementer.user == null)
|
||||||
return View();
|
return View();
|
||||||
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void Enter(string login, string password)
|
||||||
|
{
|
||||||
|
var user = _data.Login(login, password);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
UserImplementer.user = user;
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Register()
|
public IActionResult Register()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void Register(string name, string login, string email, string password1, string password2)
|
||||||
|
{
|
||||||
|
if (password1 == password2 && _data.Register(new() { Email = email, Login = login, Name = name, Password = password1 }))
|
||||||
|
{
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
public IActionResult IndexDetail()
|
public IActionResult IndexDetail()
|
||||||
{
|
{
|
||||||
var details = new List<DetailViewModel>();
|
if (UserImplementer.user != null)
|
||||||
details.Add(new DetailViewModel
|
|
||||||
{
|
{
|
||||||
Id = 1,
|
var list = _data.GetDetails(UserImplementer.user.Id);
|
||||||
Name = "Test",
|
if (list != null)
|
||||||
Cost = 55.5,
|
return View(list);
|
||||||
UserId = 1
|
return View(new List<DetailViewModel>());
|
||||||
});
|
|
||||||
details.Add(new DetailViewModel
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Name = "Test1",
|
|
||||||
Cost = 32,
|
|
||||||
UserId = 2
|
|
||||||
});
|
|
||||||
return View(details);
|
|
||||||
}
|
}
|
||||||
public IActionResult CreateDetail()
|
return RedirectToAction("IndexNonReg");
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void IndexDetail(int id)
|
||||||
{
|
{
|
||||||
|
if (UserImplementer.user != null)
|
||||||
|
{
|
||||||
|
_data.DeleteDetail(id);
|
||||||
|
}
|
||||||
|
Response.Redirect("IndexDetail");
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CreateDetail(int id)
|
||||||
|
{
|
||||||
|
if (id != 0)
|
||||||
|
{
|
||||||
|
var value = _data.GetDetail(id);
|
||||||
|
if (value != null)
|
||||||
|
return View(value);
|
||||||
|
}
|
||||||
|
return View(new DetailViewModel());
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult CreateDetail(DetailBindingModel model)
|
||||||
|
{
|
||||||
|
if (model.Id == 0)
|
||||||
|
{
|
||||||
|
model.DateCreate = DateTime.Now;
|
||||||
|
model.UserId = UserImplementer.user!.Id;
|
||||||
|
if (_data.CreateDetail(model))
|
||||||
|
return RedirectToAction("IndexDetail");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_data.UpdateDetail(model))
|
||||||
|
return RedirectToAction("IndexDetail");
|
||||||
|
}
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
public IActionResult IndexProduct()
|
public IActionResult IndexProduct()
|
||||||
{
|
{
|
||||||
List<ProductViewModel> products = new List<ProductViewModel>
|
if (UserImplementer.user != null) {
|
||||||
{
|
var products = _data.GetProducts(UserImplementer.user.Id);
|
||||||
new ProductViewModel
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Name = "Изделие 1",
|
|
||||||
Cost = 10.99,
|
|
||||||
UserId = 1,
|
|
||||||
MachineId = 1
|
|
||||||
},
|
|
||||||
new ProductViewModel
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Name = "Изделие 2",
|
|
||||||
Cost = 19.99,
|
|
||||||
UserId = 2,
|
|
||||||
MachineId = 2
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return View(products);
|
return View(products);
|
||||||
}
|
}
|
||||||
|
return RedirectToAction("IndexNonReg");
|
||||||
|
}
|
||||||
public IActionResult CreateProduct()
|
public IActionResult CreateProduct()
|
||||||
{
|
{
|
||||||
var details = new List<DetailViewModel>();
|
var details = new List<DetailViewModel>();
|
||||||
@ -100,26 +137,15 @@ namespace ImplementerApp.Controllers
|
|||||||
});
|
});
|
||||||
return View(details);
|
return View(details);
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
public IActionResult IndexProduction()
|
public IActionResult IndexProduction()
|
||||||
{
|
{
|
||||||
List<ProductionViewModel> productionViewModels = new List<ProductionViewModel>
|
if (UserImplementer.user != null)
|
||||||
{
|
{
|
||||||
new ProductionViewModel
|
var productions = _data.GetProductions(UserImplementer.user.Id);
|
||||||
{
|
return View(productions);
|
||||||
Id = 1,
|
|
||||||
Name = "Производство А",
|
|
||||||
Cost = 1000.00,
|
|
||||||
UserId = 1
|
|
||||||
},
|
|
||||||
new ProductionViewModel
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Name = "Производство Б",
|
|
||||||
Cost = 1500.00,
|
|
||||||
UserId = 2
|
|
||||||
}
|
}
|
||||||
};
|
return RedirectToAction("IndexNonReg");
|
||||||
return View(productionViewModels);
|
|
||||||
}
|
}
|
||||||
public IActionResult CreateProduction()
|
public IActionResult CreateProduction()
|
||||||
{
|
{
|
||||||
|
@ -8,11 +8,13 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.26" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.26" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
|
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||||
|
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
77
Course/ImplementerApp/ImplementerData.cs
Normal file
77
Course/ImplementerApp/ImplementerData.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using Contracts.BusinessLogicsContracts;
|
||||||
|
using Contracts.ViewModels;
|
||||||
|
using Contracts.BindingModels;
|
||||||
|
using Contracts.StoragesContracts;
|
||||||
|
using Contracts.SearchModels;
|
||||||
|
|
||||||
|
namespace ImplementerApp
|
||||||
|
{
|
||||||
|
public class ImplementerData
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _implementerLogic;
|
||||||
|
private readonly IDetailLogic _detailLogic;
|
||||||
|
private readonly IProductionLogic _productionLogic;
|
||||||
|
private readonly IProductLogic _productLogic;
|
||||||
|
|
||||||
|
public ImplementerData(ILogger<ImplementerData> logger, IImplementerLogic implementerLogic, IDetailLogic detailLogic, IProductionLogic productionLogic, IProductLogic productLogic)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_implementerLogic = implementerLogic;
|
||||||
|
_detailLogic = detailLogic;
|
||||||
|
_productionLogic = productionLogic;
|
||||||
|
_productLogic = productLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplementerViewModel? Login(string login, string password)
|
||||||
|
{
|
||||||
|
return _implementerLogic.ReadElement(new()
|
||||||
|
{
|
||||||
|
Login = login,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Register(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
return _implementerLogic.Create(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UpdateUser(ImplementerBindingModel model)
|
||||||
|
{
|
||||||
|
return _implementerLogic.Update(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DetailViewModel>? GetDetails(int userId)
|
||||||
|
{
|
||||||
|
return _detailLogic.ReadList(new DetailSearchModel() { UserId = userId });
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteDetail(int detailId)
|
||||||
|
{
|
||||||
|
return _detailLogic.Delete(new() { Id = detailId });
|
||||||
|
}
|
||||||
|
public bool CreateDetail(DetailBindingModel model)
|
||||||
|
{
|
||||||
|
return _detailLogic.Create(model);
|
||||||
|
}
|
||||||
|
public bool UpdateDetail(DetailBindingModel model)
|
||||||
|
{
|
||||||
|
return _detailLogic.Update(model);
|
||||||
|
}
|
||||||
|
public DetailViewModel? GetDetail(int id)
|
||||||
|
{
|
||||||
|
return _detailLogic.ReadElement(new() { Id= id });
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProductViewModel>? GetProducts(int userId)
|
||||||
|
{
|
||||||
|
return _productLogic.ReadList(new ProductSearchModel() { UserId = userId });
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProductionViewModel>? GetProductions(int userId)
|
||||||
|
{
|
||||||
|
return _productionLogic.ReadList(new() { UserId = userId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,27 @@
|
|||||||
|
using BusinessLogic.BusinessLogic;
|
||||||
using Contracts.BusinessLogicsContracts;
|
using Contracts.BusinessLogicsContracts;
|
||||||
|
using Contracts.StoragesContracts;
|
||||||
|
using DatabaseImplement.Implements;
|
||||||
|
using ImplementerApp;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
||||||
|
|
||||||
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
|
builder.Logging.AddLog4Net("log4net.config");
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
builder.Services.AddTransient<IDetailStorage, DetailStorage>();
|
||||||
|
builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
||||||
|
builder.Services.AddTransient<IProductionStorage, ProductionStorage>();
|
||||||
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
|
builder.Services.AddTransient<IDetailLogic, DetailLogic>();
|
||||||
|
builder.Services.AddTransient<IProductionLogic, ProductionLogic>();
|
||||||
|
builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
||||||
|
builder.Services.AddTransient<ImplementerData>();
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
|
9
Course/ImplementerApp/UserImplementer.cs
Normal file
9
Course/ImplementerApp/UserImplementer.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Contracts.ViewModels;
|
||||||
|
|
||||||
|
namespace ImplementerApp
|
||||||
|
{
|
||||||
|
public static class UserImplementer
|
||||||
|
{
|
||||||
|
public static ImplementerViewModel? user { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,20 @@
|
|||||||
@{
|
@using Contracts.ViewModels;
|
||||||
|
@{
|
||||||
ViewData["Title"] = "CreateDetail";
|
ViewData["Title"] = "CreateDetail";
|
||||||
}
|
}
|
||||||
|
@model DetailViewModel;
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h2 class="display-4">Создание детали</h2>
|
<h2 class="display-4">Деталь</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<input type="text" name="title" id="title" value="@Model.Id" hidden="hidden"/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Название:</div>
|
<div class="col-4">Название:</div>
|
||||||
<div class="col-8"><input type="text" name="title" id="title" /></div>
|
<div class="col-8"><input type="text" name="name" id="name" value="@Model.Name"/></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Цена:</div>
|
<div class="col-4">Цена:</div>
|
||||||
<div class="col-8"><input type="text" name="cost" id="cost" /></div>
|
<div class="col-8"><input type="text" name="cost" id="cost" value="@Model.Cost"/></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
|
@ -19,22 +19,21 @@
|
|||||||
<table id="detailsTable" class="display">
|
<table id="detailsTable" class="display">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Выбор</th>
|
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
<th>Количество</th>
|
<th>Количество</th>
|
||||||
|
<th>Удалить</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var detail in Model)
|
@foreach (var detail in Model)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="details" value="@detail.Id" />
|
|
||||||
</td>
|
|
||||||
<td>@detail.Name</td>
|
<td>@detail.Name</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="number" name="count" value="0" min="0" class="form-control" />
|
<input type="number" name="count" value="0" min="0" class="form-control" />
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -3,14 +3,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Приложение "Завод "Иди работать". Исполнитель"</h1>
|
<h1 class="display-4">Главное меню</h1>
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexDetail">Детали</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexDetail">Детали</a>
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduct">Изделия</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduct">Изделия</a>
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduction">Производства</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexProduction">Производства</a>
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportsMenu">Меню отчетов</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportsMenu">Меню отчетов</a>
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="CreateDetail">Создать деталь</a>
|
<a asp-action="CreateDetail" asp-route-id="0">Создать деталь</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -57,7 +57,10 @@
|
|||||||
<a asp-action="CreateDetail" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
<a asp-action="CreateDetail" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="DeleteDetail" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
|
<form method="post">
|
||||||
|
<input type="text" title="id" name="id" value="@item.Id" hidden="hidden"/>
|
||||||
|
<input type="submit" class="btn btn-danger" value="Удалить"/>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
10
Course/ImplementerApp/Views/Home/IndexNonReg.cshtml
Normal file
10
Course/ImplementerApp/Views/Home/IndexNonReg.cshtml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="list-group">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -10,7 +10,6 @@
|
|||||||
<h1 class="display-4">Изделия</h1>
|
<h1 class="display-4">Изделия</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
ProductMachineAdd
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
if (Model == null)
|
if (Model == null)
|
||||||
@ -19,7 +18,7 @@ ProductMachineAdd
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="CreateProduct">Создать изделие</a>
|
<a asp-action="CreateProduct" asp-route-id="0">Создать изделие</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -64,7 +63,10 @@ ProductMachineAdd
|
|||||||
<a asp-action="CreateProduct" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
<a asp-action="CreateProduct" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="DeleteProduct" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
|
<form method="post">
|
||||||
|
<input type="text" title="id" name="id" value="@item.Id" hidden="hidden" />
|
||||||
|
<input type="submit" class="btn btn-danger" value="Удалить" />
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="CreateProduction">Создать производство</a>
|
<a asp-action="CreateProduction" asp-route-id="0">Создать производство</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -57,7 +57,10 @@
|
|||||||
<a asp-action="CreateProduction" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
<a asp-action="CreateProduction" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
|
<form method="post">
|
||||||
|
<input type="text" title="id" name="id" value="@item.Id" hidden="hidden" />
|
||||||
|
<input type="submit" class="btn btn-danger" value="Удалить" />
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<h2 class="display-4">Личные данные</h2>
|
<h2 class="display-4">Личные данные</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<input type="text" name="login" value="@Model.Id" hidden="hidden"/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Логин:</div>
|
<div class="col-4">Логин:</div>
|
||||||
<div class="col-8"><input type="text" name="login" value="@Model.Login" /></div>
|
<div class="col-8"><input type="text" name="login" value="@Model.Login" /></div>
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
@{
|
||||||
|
ViewData["Name"] = UserImplementer.user == null ? "Пользователь" : UserImplementer.user.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
@ -13,7 +17,8 @@
|
|||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<img src="~/images/Work-transformed.png" width="150" height="150" alt="Логотип">
|
<img src="~/images/Work-transformed.png" width="150" height="150" alt="Логотип">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Исполнитель</a>
|
<a asp-controller="Home" asp-action="Index">Приложение "Завод "Иди работать". Исполнитель"</a>
|
||||||
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Privacy">@ViewData["Name"]</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
16
Course/ImplementerApp/log4net.config
Normal file
16
Course/ImplementerApp/log4net.config
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<log4net>
|
||||||
|
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
|
||||||
|
<file value="c:/temp/GoWorkCourse.log" />
|
||||||
|
<appendToFile value="true" />
|
||||||
|
<maximumFileSize value="100KB" />
|
||||||
|
<maxSizeRollBackups value="2" />
|
||||||
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
|
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
<root>
|
||||||
|
<level value="TRACE" />
|
||||||
|
<appender-ref ref="RollingFile" />
|
||||||
|
</root>
|
||||||
|
</log4net>
|
Loading…
Reference in New Issue
Block a user