Beispiel #1
0
 public void Update(int id, string name, string material)
 {
     if (_medalDao.GetById(id) == null)
     {
         throw new Exception($"Medal with id = {id} not available");
     }
     else
     {
         if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(material))
         {
             throw new ArgumentNullException("It is not possible to UPDATE a medal without a name or material.");
         }
         else
         {
             _medalDao.Update(id, name, material);
         }
     }
 }
Beispiel #2
0
        // метод всех награжденных людей
        public Reward[] GetAll()
        {
            List <Reward>       rewards     = new List <Reward>();
            IEnumerable <int[]> rewardsPair = _rewardDao.GetAll();

            foreach (int[] pair in rewardsPair)
            {
                Reward next = new Reward();
                next.awarded = _personDao.GetById(pair[0]);
                next.medal   = _medalDao.GetById(pair[1]);
                rewards.Add(next);
            }
            return(rewards.ToArray());
        }