private static void AddSpaceship(string name) { var spaceship = new Spaceship { Name = name }; using (var context = new SpaceshipContext()) { context.Spaceships.Add(spaceship); context.SaveChanges(); } }
private static void AddRavioliForSpaceship(string name, int number, DateTime packed) { var spaceship = new Spaceship { Name = name, RavioliInSpaceship = new List <RavioliInSpaceship> { new RavioliInSpaceship { Ravioli = new Ravioli { Packed = packed } } } }; using (var context = new SpaceshipContext()) { context.Spaceships.Add(spaceship); context.SaveChanges(); } }