Esempio n. 1
0
        public void deleteEntry(Wing entry)
        {
            Wing dbEntry = context.Wings.FirstOrDefault(p => p == entry);

            context.Wings.Remove(dbEntry);
            context.SaveChanges();
        }
Esempio n. 2
0
 public void saveEntry(Wing entry)
 {
     if (context.Wings.Any(c => c.Name == entry.Name))
     {
         Wing dbEntry = context.Wings
                        .FirstOrDefault(p => p.Name == entry.Name);
         if (dbEntry != null)
         {
             dbEntry.Name      = entry.Name;
             dbEntry.Location  = entry.Location;
             dbEntry.Commander = entry.Commander;
             dbEntry.Mission   = entry.Mission;
             dbEntry.Size      = entry.Size;
             dbEntry.Motto     = entry.Motto;
         }
     }
     else
     {
         context.Wings.Add(entry);
     }
     context.SaveChanges();
 }