public void UpdateTown(Towns town) { var item = olympicGamesDBContext.Towns.Find(town.Id); if (item != null) { olympicGamesDBContext.Entry(item).CurrentValues.SetValues(town); olympicGamesDBContext.SaveChanges(); } }
/// <summary> /// Updates a club in the database. /// </summary> /// <param name="club">The club that is being updated.</param> public void UpdateClub(Clubs club) { var item = olympicGamesDBContext.Clubs.Find(club.Id); if (item != null) { olympicGamesDBContext.Entry(item).CurrentValues.SetValues(club); olympicGamesDBContext.SaveChanges(); } }
/// <summary> /// Updates a coach in the database. /// </summary> /// <param name="coach">The coach that is being updated.</param> public void UpdateCoach(Coaches coach) { var item = olympicGamesDBContext.Coaches.Find(coach.Id); if (item != null) { olympicGamesDBContext.Entry(item).CurrentValues.SetValues(coach); olympicGamesDBContext.SaveChanges(); } }
/// <summary> /// Updates a competitor in the database. /// </summary> /// <param name="competitor">The competitor that is being updated.</param> public void UpdateCompetitor(Competitors competitor) { var item = olympicGamesDBContext.Competitors.Find(competitor.Id); if (item != null) { olympicGamesDBContext.Entry(item).CurrentValues.SetValues(competitor); olympicGamesDBContext.SaveChanges(); } }