Ejemplo n.º 1
0
        public void deleteEntry(Majcom entry)
        {
            Majcom dbEntry = context.Majcoms.FirstOrDefault(p => p == entry);

            context.Majcoms.Remove(dbEntry);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
 public void saveEntry(Majcom entry)
 {
     if (context.Majcoms.Any(c => c.Name == entry.Name))
     {
         Majcom dbEntry = context.Majcoms
                          .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.Majcoms.Add(entry);
     }
     context.SaveChanges();
 }