Пример #1
0
 public bool MakePay(int meetingId, string userName)
 {
     int price = _meetingsRepository.GetById(meetingId).Price;
     string meetingUserName = _meetingsRepository.GetById(meetingId).UserName;
     if (meetingUserName != userName)
     {
         return false;
     }
     try
     {
         if (_moneyRepository.RemoveMoney(userName, price))
         {
             _meetingsRepository.Pay(meetingId);
         }
         else
         {
             throw new Exception("Not enough money");
         }
     }
     catch
     {
         return false;
     }
     return true;
 }