Фальшивого дрессировщика в цирке быстро раскусили.

This commit is contained in:
Дмитрий Блохин 2024-05-01 13:10:02 +04:00
commit 3cbab2be56
4 changed files with 18 additions and 3 deletions

View File

@ -14,7 +14,6 @@ namespace DatabaseImplement.Models
public int DetailId { get; set; }
[Required]
public int ProductionId { get; set; }
public virtual Detail Detail { get; set; } = new();
public virtual Production Production { get; set; } = new();
}

View File

@ -68,7 +68,7 @@ namespace DatabaseImplement.Models
var productionDetails = context.DetailProductions.Where(rec => rec.ProductionId == model.Id).ToList();
if (productionDetails != null && productionDetails.Count > 0)
{
context.DetailProductions.RemoveRange(productionDetails.Where(rec => model.ProductionDetails.ContainsKey(rec.ProductionId)));
context.DetailProductions.RemoveRange(productionDetails.Where(rec => !model.ProductionDetails.ContainsKey(rec.ProductionId)));
context.SaveChanges();
}
var production = context.Productions.First(x => x.Id == model.Id);

View File

@ -14,3 +14,17 @@ ProductionStorage productionionStorage = new ProductionStorage();
ProductStorage productStorage = new ProductStorage();
MachineStorage machineStorage = new MachineStorage();
GuarantorStorage guarantorStorage = new GuarantorStorage();
productionionStorage.Update(new()
{
Id = 4,
Name = "name",
Cost = 1,
UserId = 1,
ProductionDetails = new()
{
{1, detailStorage.GetElement(new() { Id = 1 }) },
{3, detailStorage.GetElement(new() { Id = 3 }) }
}
});

View File

@ -1,2 +1,4 @@
# Coursach
Курсовая работа студентов группы ПИбд-21 Козырева Сергея и Блохина Дмитрия.
Вариант 10.3 + 10.4. Завод "Иди работать" Исполнитель + Поручитель