FixDatabase + UpdateView

Заряжай, заря-заря-жай, заряжай меня
Мне не спрятаться от тебя и не убежать
This commit is contained in:
Sergey Kozyrev 2024-04-30 17:03:49 +04:00
parent 8e9e4dd321
commit f502a218a7
21 changed files with 206 additions and 90 deletions

View File

@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseImplement", "Databa
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImplementerApp", "ImplementerApp\ImplementerApp.csproj", "{9CEB1DEF-2254-4745-89C9-832E2F857BF4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImplementerApp", "ImplementerApp\ImplementerApp.csproj", "{9CEB1DEF-2254-4745-89C9-832E2F857BF4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuarantorAPP", "GuarantorAPP\GuarantorAPP.csproj", "{9B5881EA-1F06-422A-85F4-BDD188921374}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuarantorAPP", "GuarantorAPP\GuarantorAPP.csproj", "{9B5881EA-1F06-422A-85F4-BDD188921374}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestingDatabase", "TestingDatabase\TestingDatabase.csproj", "{022506BE-1362-4426-9B66-168680BD4AA4}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -45,6 +47,10 @@ Global
{9B5881EA-1F06-422A-85F4-BDD188921374}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B5881EA-1F06-422A-85F4-BDD188921374}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B5881EA-1F06-422A-85F4-BDD188921374}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B5881EA-1F06-422A-85F4-BDD188921374}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B5881EA-1F06-422A-85F4-BDD188921374}.Release|Any CPU.Build.0 = Release|Any CPU {9B5881EA-1F06-422A-85F4-BDD188921374}.Release|Any CPU.Build.0 = Release|Any CPU
{022506BE-1362-4426-9B66-168680BD4AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{022506BE-1362-4426-9B66-168680BD4AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{022506BE-1362-4426-9B66-168680BD4AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{022506BE-1362-4426-9B66-168680BD4AA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -27,23 +27,13 @@ namespace DatabaseImplement.Implements
public List<DetailViewModel> GetFilteredList(DetailSearchModel model) public List<DetailViewModel> GetFilteredList(DetailSearchModel model)
{ {
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Name) && !model.UserId.HasValue) if (!model.UserId.HasValue)
{ {
return new(); return new();
} }
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
if (model.Id.HasValue) return context.Details.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
{
return context.Details.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
}
else if (model.UserId.HasValue)
{
return context.Details.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
}
else
{
return context.Details.Where(x => model.Name == x.Name).Select(x => x.GetViewModel).ToList();
}
} }
public List<DetailViewModel> GetFullList() public List<DetailViewModel> GetFullList()

View File

@ -3,6 +3,7 @@ using Contracts.SearchModels;
using Contracts.StoragesContracts; using Contracts.StoragesContracts;
using Contracts.ViewModels; using Contracts.ViewModels;
using DatabaseImplement.Models; using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace DatabaseImplement.Implements namespace DatabaseImplement.Implements
{ {
@ -14,6 +15,7 @@ namespace DatabaseImplement.Implements
var newProduct = context.Products.FirstOrDefault(x => x.Id == model.Id); var newProduct = context.Products.FirstOrDefault(x => x.Id == model.Id);
if (newProduct == null) if (newProduct == null)
return null; return null;
newProduct.UpdateDetails(context, model);
context.Products.Remove(newProduct); context.Products.Remove(newProduct);
context.SaveChanges(); context.SaveChanges();
return newProduct.GetViewModel; return newProduct.GetViewModel;
@ -22,34 +24,23 @@ namespace DatabaseImplement.Implements
public ProductViewModel? GetElement(ProductSearchModel model) public ProductViewModel? GetElement(ProductSearchModel model)
{ {
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
return context.Products.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Contains(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Contains(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
} }
public List<ProductViewModel> GetFilteredList(ProductSearchModel model) public List<ProductViewModel> GetFilteredList(ProductSearchModel model)
{ {
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Name) && !model.UserId.HasValue) if (!model.UserId.HasValue)
{ {
return new(); return new();
} }
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
if (model.Id.HasValue) 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.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
}
else if (model.UserId.HasValue)
{
return context.Products.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
}
else
{
return context.Products.Where(x => model.Name == x.Name).Select(x => x.GetViewModel).ToList();
}
} }
public List<ProductViewModel> GetFullList() public List<ProductViewModel> GetFullList()
{ {
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
return context.Products.Select(x => x.GetViewModel).ToList(); return context.Products.Include(p => p.Details).ThenInclude(p => p.Detail).Select(x => x.GetViewModel).ToList();
} }
public ProductViewModel? Insert(ProductBindingModel model) public ProductViewModel? Insert(ProductBindingModel model)
@ -70,6 +61,7 @@ namespace DatabaseImplement.Implements
if (newProduct == null) if (newProduct == null)
return null; return null;
newProduct.Update(model); newProduct.Update(model);
newProduct.UpdateDetails(context, model);
context.SaveChanges(); context.SaveChanges();
return newProduct.GetViewModel; return newProduct.GetViewModel;
} }

View File

@ -3,6 +3,7 @@ using Contracts.SearchModels;
using Contracts.StoragesContracts; using Contracts.StoragesContracts;
using Contracts.ViewModels; using Contracts.ViewModels;
using DatabaseImplement.Models; using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace DatabaseImplement.Implements namespace DatabaseImplement.Implements
{ {
@ -22,34 +23,23 @@ namespace DatabaseImplement.Implements
public ProductionViewModel? GetElement(ProductionSearchModel model) public ProductionViewModel? GetElement(ProductionSearchModel model)
{ {
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
return context.Productions.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Contains(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; return context.Productions.Include(x => x.Details).ThenInclude(x => x.Detail).FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name.Contains(model.Name)) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
} }
public List<ProductionViewModel> GetFilteredList(ProductionSearchModel model) public List<ProductionViewModel> GetFilteredList(ProductionSearchModel model)
{ {
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Name) && !model.UserId.HasValue) if (!model.UserId.HasValue)
{ {
return new(); return new();
} }
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
if (model.Id.HasValue) return context.Productions.Include(x => x.Details).ThenInclude(x => x.Detail).Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
{
return context.Productions.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
}
else if (model.UserId.HasValue)
{
return context.Productions.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();
}
else
{
return context.Productions.Where(x => model.Name == x.Name).Select(x => x.GetViewModel).ToList();
}
} }
public List<ProductionViewModel> GetFullList() public List<ProductionViewModel> GetFullList()
{ {
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
return context.Productions.Select(x => x.GetViewModel).ToList(); return context.Productions.Include(x => x.Details).ThenInclude(x => x.Detail).Select(x => x.GetViewModel).ToList();
} }
public ProductionViewModel? Insert(ProductionBindingModel model) public ProductionViewModel? Insert(ProductionBindingModel model)

View File

@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DatabaseImplement.Migrations namespace DatabaseImplement.Migrations
{ {
[DbContext(typeof(FactoryGoWorkDatabase))] [DbContext(typeof(FactoryGoWorkDatabase))]
[Migration("20240427200038_somestrange")] [Migration("20240430122917_tryToCheck")]
partial class somestrange partial class tryToCheck
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -330,7 +330,6 @@ namespace DatabaseImplement.Migrations
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("ProductionId") b.Property<int?>("ProductionId")
.IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Title") b.Property<string>("Title")
@ -489,10 +488,8 @@ namespace DatabaseImplement.Migrations
modelBuilder.Entity("DatabaseImplement.Models.Workshop", b => modelBuilder.Entity("DatabaseImplement.Models.Workshop", b =>
{ {
b.HasOne("DatabaseImplement.Models.Production", "Production") b.HasOne("DatabaseImplement.Models.Production", "Production")
.WithMany() .WithMany("Workshops")
.HasForeignKey("ProductionId") .HasForeignKey("ProductionId");
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Guarantor", "Guarantor") b.HasOne("DatabaseImplement.Models.Guarantor", "Guarantor")
.WithMany("Workshops") .WithMany("Workshops")
@ -543,6 +540,8 @@ namespace DatabaseImplement.Migrations
modelBuilder.Entity("DatabaseImplement.Models.Production", b => modelBuilder.Entity("DatabaseImplement.Models.Production", b =>
{ {
b.Navigation("Details"); b.Navigation("Details");
b.Navigation("Workshops");
}); });
modelBuilder.Entity("DatabaseImplement.Models.Worker", b => modelBuilder.Entity("DatabaseImplement.Models.Worker", b =>

View File

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DatabaseImplement.Migrations namespace DatabaseImplement.Migrations
{ {
public partial class somestrange : Migration public partial class tryToCheck : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -151,7 +151,8 @@ namespace DatabaseImplement.Migrations
name: "FK_Products_Machines_MachineId", name: "FK_Products_Machines_MachineId",
column: x => x.MachineId, column: x => x.MachineId,
principalTable: "Machines", principalTable: "Machines",
principalColumn: "Id"); principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -171,13 +172,13 @@ namespace DatabaseImplement.Migrations
column: x => x.WorkerId, column: x => x.WorkerId,
principalTable: "Machines", principalTable: "Machines",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
name: "FK_WorkerMachines_Workers_WorkerId", name: "FK_WorkerMachines_Workers_WorkerId",
column: x => x.WorkerId, column: x => x.WorkerId,
principalTable: "Workers", principalTable: "Workers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -197,13 +198,13 @@ namespace DatabaseImplement.Migrations
column: x => x.DetailId, column: x => x.DetailId,
principalTable: "Details", principalTable: "Details",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_DetailProductions_Productions_ProductionId", name: "FK_DetailProductions_Productions_ProductionId",
column: x => x.ProductionId, column: x => x.ProductionId,
principalTable: "Productions", principalTable: "Productions",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -216,7 +217,7 @@ namespace DatabaseImplement.Migrations
Address = table.Column<string>(type: "nvarchar(max)", nullable: false), Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
Director = table.Column<string>(type: "nvarchar(max)", nullable: false), Director = table.Column<string>(type: "nvarchar(max)", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false), UserId = table.Column<int>(type: "int", nullable: false),
ProductionId = table.Column<int>(type: "int", nullable: false) ProductionId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -232,7 +233,7 @@ namespace DatabaseImplement.Migrations
column: x => x.ProductionId, column: x => x.ProductionId,
principalTable: "Productions", principalTable: "Productions",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.SetNull);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -253,13 +254,13 @@ namespace DatabaseImplement.Migrations
column: x => x.DetailId, column: x => x.DetailId,
principalTable: "Details", principalTable: "Details",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_DetailProducts_Products_ProductId", name: "FK_DetailProducts_Products_ProductId",
column: x => x.ProductId, column: x => x.ProductId,
principalTable: "Products", principalTable: "Products",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -279,13 +280,13 @@ namespace DatabaseImplement.Migrations
column: x => x.WorkerId, column: x => x.WorkerId,
principalTable: "Workers", principalTable: "Workers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_WorkerWorkshops_Workshops_WorkshopId", name: "FK_WorkerWorkshops_Workshops_WorkshopId",
column: x => x.WorkshopId, column: x => x.WorkshopId,
principalTable: "Workshops", principalTable: "Workshops",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(

View File

@ -328,7 +328,6 @@ namespace DatabaseImplement.Migrations
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("ProductionId") b.Property<int?>("ProductionId")
.IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Title") b.Property<string>("Title")
@ -487,10 +486,8 @@ namespace DatabaseImplement.Migrations
modelBuilder.Entity("DatabaseImplement.Models.Workshop", b => modelBuilder.Entity("DatabaseImplement.Models.Workshop", b =>
{ {
b.HasOne("DatabaseImplement.Models.Production", "Production") b.HasOne("DatabaseImplement.Models.Production", "Production")
.WithMany() .WithMany("Workshops")
.HasForeignKey("ProductionId") .HasForeignKey("ProductionId");
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseImplement.Models.Guarantor", "Guarantor") b.HasOne("DatabaseImplement.Models.Guarantor", "Guarantor")
.WithMany("Workshops") .WithMany("Workshops")
@ -541,6 +538,8 @@ namespace DatabaseImplement.Migrations
modelBuilder.Entity("DatabaseImplement.Models.Production", b => modelBuilder.Entity("DatabaseImplement.Models.Production", b =>
{ {
b.Navigation("Details"); b.Navigation("Details");
b.Navigation("Workshops");
}); });
modelBuilder.Entity("DatabaseImplement.Models.Worker", b => modelBuilder.Entity("DatabaseImplement.Models.Worker", b =>

View File

@ -56,6 +56,7 @@ namespace DatabaseImplement.Models
return; return;
Email = model.Email; Email = model.Email;
Name = model.Name; Name = model.Name;
Login = model.Login;
Password = model.Password; Password = model.Password;
} }
public ImplementerViewModel GetViewModel => new() public ImplementerViewModel GetViewModel => new()

View File

@ -92,12 +92,15 @@ namespace DatabaseImplement.Models
context.SaveChanges(); context.SaveChanges();
foreach (var upDetail in productDetails) foreach (var upDetail in productDetails)
{ {
upDetail.Count = model.ProductDetails[upDetail.DetailId].Item2; if (model.ProductDetails.ContainsKey(upDetail.DetailId))
model.ProductDetails.Remove(upDetail.DetailId); {
upDetail.Count = model.ProductDetails[upDetail.DetailId].Item2;
model.ProductDetails.Remove(upDetail.DetailId);
}
} }
context.SaveChanges(); context.SaveChanges();
} }
var product = context.Products.First(x => x.Id == model.Id); var product = context.Products.FirstOrDefault(x => x.Id == model.Id);
foreach (var dp in model.ProductDetails) foreach (var dp in model.ProductDetails)
{ {
context.DetailProducts.Add(new DetailProduct context.DetailProducts.Add(new DetailProduct

View File

@ -31,8 +31,10 @@ namespace DatabaseImplement.Models
} }
} }
[ForeignKey("ProductionId")] [ForeignKey("ProductionId")]
public List<DetailProduction> Details { get; set; } = new(); public virtual List<DetailProduction> Details { get; set; } = new();
public virtual Implementer User { get; set; } public virtual Implementer User { get; set; }
[ForeignKey("ProductionId")]
public virtual List<Workshop> Workshops { get; set; }
public static Production Create(FactoryGoWorkDatabase context, ProductionBindingModel model) public static Production Create(FactoryGoWorkDatabase context, ProductionBindingModel model)
{ {

View File

@ -17,7 +17,6 @@ namespace DatabaseImplement.Models
public string Director { get; set; } = string.Empty; public string Director { get; set; } = string.Empty;
[Required] [Required]
public int UserId { get; set; } public int UserId { get; set; }
[Required]
public int? ProductionId { get; set; } public int? ProductionId { get; set; }
public virtual Production? Production { get; set; } public virtual Production? Production { get; set; }
private Dictionary<int, IWorkerModel>? _workerWorkshops = null; private Dictionary<int, IWorkerModel>? _workerWorkshops = null;

View File

@ -60,7 +60,26 @@ namespace ImplementerApp.Controllers
public IActionResult IndexProduct() public IActionResult IndexProduct()
{ {
return View(new List<ProductViewModel>()); List<ProductViewModel> products = new List<ProductViewModel>
{
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);
} }
public IActionResult CreateProduct() public IActionResult CreateProduct()
{ {
@ -83,7 +102,24 @@ namespace ImplementerApp.Controllers
} }
public IActionResult IndexProduction() public IActionResult IndexProduction()
{ {
return View(new List<ProductionViewModel>()); List<ProductionViewModel> productionViewModels = new List<ProductionViewModel>
{
new ProductionViewModel
{
Id = 1,
Name = "Производство А",
Cost = 1000.00,
UserId = 1
},
new ProductionViewModel
{
Id = 2,
Name = "Производство Б",
Cost = 1500.00,
UserId = 2
}
};
return View(productionViewModels);
} }
public IActionResult CreateProduction() public IActionResult CreateProduction()
{ {
@ -105,16 +141,53 @@ namespace ImplementerApp.Controllers
return View(details); return View(details);
} }
public IActionResult Privacy() public IActionResult Privacy()
{ {
return View(); ImplementerViewModel user = new()
{
Email = "mail@mail.ru",
Login = "Login",
Password = "password",
Name = "User"
};
return View(user);
} }
public IActionResult DetailTimeReport() public IActionResult DetailTimeReport()
{ {
return View(new List<DetailTimeReport>()); List<DetailTimeReport> detailTimeReports = new List<DetailTimeReport>
{
new DetailTimeReport
{
DetailName = "Деталь А",
Productions = new List<string> { "Производство 1", "Производство 2" },
Machines = new List<string> { "Машина X", "Машина Y" }
},
new DetailTimeReport
{
DetailName = "Деталь B",
Productions = new List<string> { "Производство 3", "Производство 4" },
Machines = new List<string> { "Машина Z", "Машина W" }
}
};
return View(detailTimeReports);
} }
public IActionResult DetailWorkshopReport() public IActionResult DetailWorkshopReport()
{ {
return View(new List<DetailWorkshopReportViewModel>()); List<DetailWorkshopReportViewModel> detailWorkshopReports = new List<DetailWorkshopReportViewModel>
{
new DetailWorkshopReportViewModel
{
DetailName = "Деталь X",
WorkShops = new List<string> { "Цех 1", "Цех 2" }
},
new DetailWorkshopReportViewModel
{
DetailName = "Деталь Y",
WorkShops = new List<string> { "Цех 3", "Цех 4" }
}
};
return View(detailWorkshopReports);
} }
public IActionResult ReportsMenu() public IActionResult ReportsMenu()
{ {

View File

@ -14,13 +14,14 @@
<div class="col-8"><input type="text" name="title" id="title" /></div> <div class="col-8"><input type="text" name="title" id="title" /></div>
</div> </div>
<div class="container"> <div class="container">
<div>Details</div> <div>Детали</div>
<div class="table-responsive-lg"> <div class="table-responsive-lg">
<table id="detailsTable" class="display"> <table id="detailsTable" class="display">
<thead> <thead>
<tr> <tr>
<th>Выбор</th> <th>Выбор</th>
<th>Название</th> <th>Название</th>
<th>Количество</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -21,7 +21,6 @@
<tr> <tr>
<th>Выбор</th> <th>Выбор</th>
<th>Название</th> <th>Название</th>
<th>Количество</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -57,7 +57,7 @@
<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="Delete" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a> <a asp-action="DeleteDetail" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
</td> </td>
</tr> </tr>
} }

View File

@ -7,11 +7,10 @@
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Изедлия</h1> <h1 class="display-4">Изделия</h1>
</div> </div>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ProductMachineAdd">Привязать станок к изделию</a> ProductMachineAdd
<div class="text-center"> <div class="text-center">
@{ @{
if (Model == null) if (Model == null)
@ -34,6 +33,9 @@
<th> <th>
Цена Цена
</th> </th>
<th>
Привязка станка к изделию
</th>
<th> <th>
Изменить изделие Изменить изделие
</th> </th>
@ -55,11 +57,14 @@
<td> <td>
@Html.DisplayFor(modelItem => item.Cost) @Html.DisplayFor(modelItem => item.Cost)
</td> </td>
<td>
<a asp-action="ProductMachineAdd" asp-route-id="@item.Id" class="btn btn-primary">Привязать станок</a>
</td>
<td> <td>
<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="Delete" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a> <a asp-action="DeleteProduct" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
</td> </td>
</tr> </tr>
} }

View File

@ -1,6 +1,28 @@
@{ @{
ViewData["Title"] = "Privacy Policy"; ViewData["Title"] = "Privacy Policy";
} }
<h1>@ViewData["Title"]</h1> <div class="text-center">
<h2 class="display-4">Личные данные</h2>
<p>Use this page to detail your site's privacy policy.</p> </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="email" name="email" value="@Model.Email" /></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="fio" value="@Model.Name" /></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>

View File

@ -12,7 +12,8 @@
<header> <header>
<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">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Завод "Иди работать". Исполнитель</a> <img src="~/images/Work-transformed.png" width="150" height="150" alt="Логотип">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Исполнитель</a>
</div> </div>
</nav> </nav>
</header> </header>

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -0,0 +1,17 @@
using DatabaseImplement;
using DatabaseImplement.Implements;
using Contracts.BindingModels;
using Contracts.BusinessLogicsContracts;
using Contracts.SearchModels;
using Contracts.ViewModels;
using Microsoft.EntityFrameworkCore.Query.Internal;
using DatabaseImplement.Models;
using DataModels.Models;
DetailStorage detailStorage = new DetailStorage();
ImplementerStorage implementationStorage = new ImplementerStorage();
ProductionionStorage productionionStorage = new ProductionionStorage();
ProductStorage productStorage = new ProductStorage();
var i = productStorage.GetFullList();
Console.WriteLine(i);

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>
</Project>