protected override void Seed(LabContext context) { var tp1 = new TroopList { Place = "A", NumberRoom = "123", }; var tp2 = new TroopList { Place = "B", NumberRoom = "563", }; var tp3 = new TroopList { Place = "C", NumberRoom = "123", }; var tp4 = new TroopList { Place = "C", NumberRoom = "123", }; var tp5 = new TroopList { Place = "C", NumberRoom = "123", }; var childrens = new List <Parental> { new Parental { FIO_rod = "ППП", Phone = "8(495)999-000-12", TroopLists = new[] { tp1, tp2, } }, new Parental { FIO_rod = "ПП1", Phone = "8(495)456-000-88", TroopLists = new[] { tp2, tp3, tp4 } }, new Parental { FIO_rod = "ПП2", Phone = "8(495)111-000-56", TroopLists = new[] { tp1, tp4, tp5 } }, }; childrens.ForEach(c => context.Parentals.Add(c)); }
protected override void Seed(LabContext context) { var tp1 = new TroopList { Place = "A", NumberRoom = "123", }; var tp2 = new TroopList { Place = "B", NumberRoom = "563", }; var tp3 = new TroopList { Place = "C", NumberRoom = "123", }; var tp4 = new TroopList { Place = "C", NumberRoom = "123", }; var tp5 = new TroopList { Place = "C", NumberRoom = "123", }; var childrens = new List <Parental> { new Parental { FIO_rod = "ППП", Phone = "8(495)999-000-12", TroopLists = new[] { tp1, tp2 } }, new Parental { FIO_rod = "ПП1", Phone = "8(495)456-000-88", TroopLists = new[] { tp2, tp3, tp4 } }, new Parental { FIO_rod = "ПП2", Phone = "8(495)111-000-56", TroopLists = new[] { tp1, tp4, tp5 } }, }; childrens.ForEach(c => context.Parentals.Add(c)); context.SaveChanges(); Children child1 = new Children { FIO_reb = "Колодезов Роберт Андреевич", Birthdate = "12.04.02" }; Children child2 = new Children { FIO_reb = "Фирман Том Карлович", Birthdate = "12.05.02" }; Children child3 = new Children { FIO_reb = "Фирман Том Карлович", Birthdate = "12.05.02" }; CardChildren card = new CardChildren { Information = "Талантливый художник" }; CardChildren card2 = new CardChildren { Information = "Шахматист уровня гроссмейстера" }; CardChildren card3 = new CardChildren { Information = "Шахматист уровня гроссмейстера" }; context.CardChildrens.Add(card); context.Childrens.Add(child1); context.SaveChanges(); context.CardChildrens.Add(card2); context.Childrens.Add(child2); context.SaveChanges(); context.CardChildrens.Add(card3); context.Childrens.Add(child3); context.SaveChanges(); }