public void deleteEntry(HeadquartersAF entry) { HeadquartersAF dbEntry = context.HeadquartersAF.FirstOrDefault(p => p == entry); context.HeadquartersAF.Remove(dbEntry); context.SaveChanges(); }
public void saveEntry(HeadquartersAF entry) { if (context.HeadquartersAF.Any(c => c.StaffName == entry.StaffName)) { HeadquartersAF dbEntry = context.HeadquartersAF .FirstOrDefault(p => p.StaffName == entry.StaffName); if (dbEntry != null) { dbEntry.StaffName = entry.StaffName; dbEntry.Location = entry.Location; dbEntry.Commander = entry.Commander; dbEntry.Mission = entry.Mission; dbEntry.CommanderTitle = entry.CommanderTitle; } } else { context.HeadquartersAF.Add(entry); } context.SaveChanges(); }