示例#1
0
 public void AddSpaceship(string name)
 {
     using (var context = new SpaceshipContext())
     {
         var Spaceship = new Spaceship
         {
             Name = name,
         };
         context.Spaceships.Add(Spaceship);
         context.SaveChanges();
     }
 }
示例#2
0
 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();
         }
     }
 }