示例#1
0
        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);
        }
示例#2
0
 public void Delete(Athlete athlete)
 {
     db.Athletes.Remove(athlete);
     db.SaveChanges();
 }