public FireCode DeleteFireCode(int FireCodeID) { FireCode dbEntry = context.FireCodes .FirstOrDefault(p => p.FireCodeID == FireCodeID); if (dbEntry != null) { context.FireCodes.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public void SaveFireCode(FireCode fireCode) { if (fireCode.FireCodeID == 0) { context.FireCodes.Add(fireCode); } else { FireCode dbEntry = context.FireCodes .FirstOrDefault(p => p.FireCodeID == fireCode.FireCodeID); if (dbEntry != null) { dbEntry.Name = fireCode.Name; } } context.SaveChanges(); }