public IActionResult DeleteBurial(int BurialId) { foreach (Artifacts a in context.Artifacts.Where(a => a.BurialId == BurialId)) { context.Artifacts.Remove(a); } context.SaveChanges(); foreach (C14Sample c in context.C14Sample.Where(c => c.BurialId == BurialId)) { context.C14Sample.Remove(c); } context.SaveChanges(); foreach (BiologicalSample bs in context.BiologicalSample.Where(bs => bs.BurialId == BurialId)) { context.BiologicalSample.Remove(bs); } context.SaveChanges(); foreach (Preservation p in context.Preservation.Where(p => p.BurialId == BurialId)) { context.Preservation.Remove(p); } context.SaveChanges(); foreach (Bones b in context.Bones.Where(b => b.BurialId == BurialId)) { context.Remove(b); } foreach (Files f in context.Files.Where(f => f.BurialId == BurialId)) { context.Remove(f); } context.SaveChanges(); Burial burial = context.Burial.Single(b => b.BurialId == BurialId); context.Remove(burial); context.SaveChanges(); return(RedirectToAction("Burial")); }