public Athlete Save(Athlete athlete) { if (athlete.athlete_id == 0) { // insert db.Athletes.Add(athlete); } else { // update db.Entry(athlete).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); return(athlete); }
public void Delete(Athlete athlete) { db.Athletes.Remove(athlete); db.SaveChanges(); }