public bool RegisterSportsman(Sportsman sportsman) { if (Sportsmen.Contains(sportsman)) { return(false); } Sportsmen.Add(sportsman); return(true); }
public bool AddMedalToSportsman(Sportsman sportsman, MedalType medalType) { var newMedal = new MedalSportsman(sportsman, medalType); if (Medals.Contains(newMedal)) { return(false); } Medals.Add(newMedal); return(true); }
public bool RemoveSportsman(Sportsman sportsman) { if (Sportsmen.Contains(sportsman)) { if (Medals.Any(m => m.Sportsman == sportsman)) { throw new Exception($"{sportsman} can not be removed because he/she has involved in a competition"); } else { Sportsmen.Remove(sportsman); return(true); } } return(false); }
public void ChangeSportsmanMedal(Sportsman sportsman, MedalType medalType) { Medals.FirstOrDefault(m => m.Sportsman == sportsman).ChangeMedalType(medalType); }
public void RemoveMedalToSportsman(Sportsman sportsman) { Medals.Remove(Medals.FirstOrDefault(m => m.Sportsman == sportsman)); }
public MedalSportsman(Sportsman sportsman, MedalType medalType) { Sportsman = sportsman; MedalType = medalType; }