Esempio n. 1
0
 public bool RegisterSportsman(Sportsman sportsman)
 {
     if (Sportsmen.Contains(sportsman))
     {
         return(false);
     }
     Sportsmen.Add(sportsman);
     return(true);
 }
Esempio n. 2
0
        public bool AddMedalToSportsman(Sportsman sportsman, MedalType medalType)
        {
            var newMedal = new MedalSportsman(sportsman, medalType);

            if (Medals.Contains(newMedal))
            {
                return(false);
            }
            Medals.Add(newMedal);
            return(true);
        }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 public void ChangeSportsmanMedal(Sportsman sportsman, MedalType medalType)
 {
     Medals.FirstOrDefault(m => m.Sportsman == sportsman).ChangeMedalType(medalType);
 }
Esempio n. 5
0
 public void RemoveMedalToSportsman(Sportsman sportsman)
 {
     Medals.Remove(Medals.FirstOrDefault(m => m.Sportsman == sportsman));
 }
Esempio n. 6
0
 public MedalSportsman(Sportsman sportsman, MedalType medalType)
 {
     Sportsman = sportsman;
     MedalType = medalType;
 }