ASP.NET
1
Вклад в тег
public virtual List<Zakupki> Zakupki { get; set; }
public virtual List<Zakladki> Zakladki { get; set; }
public virtual List<Vivod> Vivod { get; set; }
public virtual List<Prodagi> Prodagi { get; set; }
, то есть навигационные свойства были null.[HttpPost]
public ActionResult Delete(Partiya partiya)
{
BirdKeepingDBContext context = new BirdKeepingDBContext();
if (ModelState.IsValid)
{
Partiya part = context.Partiya
.Include("Zakupki")
.Include("Zakladki")
.Include("Vivod")
.Include("Prodagi")
.Single(p => p.NomerPartii == partiya.NomerPartii);
context.Partiya.Remove(part);
context.SaveChanges();
}
return View(partiya);
}
context.Partiya
.Include("Zakupki")
.Include("Zakladki")
.Include("Vivod")
.Include("Prodagi")