Esempio n. 1
0
        public LandingSystem DeleteLandingSystem(int LandingSystemID)
        {
            LandingSystem dbEntry = context.LandingSystems
                                    .FirstOrDefault(p => p.LandingSystemID == LandingSystemID);

            if (dbEntry != null)
            {
                context.LandingSystems.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
Esempio n. 2
0
 public void SaveLandingSystem(LandingSystem landingSystem)
 {
     if (landingSystem.LandingSystemID == 0)
     {
         context.LandingSystems.Add(landingSystem);
     }
     else
     {
         LandingSystem dbEntry = context.LandingSystems
                                 .FirstOrDefault(p => p.LandingSystemID == landingSystem.LandingSystemID);
         if (dbEntry != null)
         {
             dbEntry.Name   = landingSystem.Name;
             dbEntry.UsedIn = landingSystem.UsedIn;
         }
     }
     context.SaveChanges();
 }