public void deleteEntry(NumberedAF entry) { NumberedAF dbEntry = context.NumberedAFs.FirstOrDefault(p => p == entry); context.NumberedAFs.Remove(dbEntry); context.SaveChanges(); }
public void saveEntry(NumberedAF entry) { if (context.NumberedAFs.Any(c => c.Name == entry.Name)) { NumberedAF dbEntry = context.NumberedAFs .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.Majcom = entry.Majcom; dbEntry.Motto = entry.Motto; } } else { context.NumberedAFs.Add(entry); } context.SaveChanges(); }