public void AddSpaceship(string name) { using (var context = new SpaceshipContext()) { var Spaceship = new Spaceship { Name = name, }; context.Spaceships.Add(Spaceship); context.SaveChanges(); } }
internal void AddRavioliForSpaceship(string nameOfSpaceShip, int cans, string v3) { using (var context = new SpaceshipContext()) { Spaceship space = GetSpaceShipByName(nameOfSpaceShip); if (space != null) { space.food.Add(new Food { Name = "Ravioli", Quantity = cans, Made = v3 }); context.SaveChanges(); } } }