Beispiel #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;
 }
Beispiel #2
0
        public void Delete(int Id)
        {
            string userName = _meetingsRepository.GetById(Id).UserName;

            if (_meetingsRepository.GetById(Id).Status == Meeting.StatusTypes.Paid)
            {
                _moneyRepository.AddMoney(userName, _meetingsRepository.GetById(Id).Price);
            }
            _meetingsRepository.DeleteById(Id);
        }
Beispiel #3
0
        // GET: Meetings/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Meeting meeting = _mdb.GetById((int)id);

            if (meeting == null)
            {
                return(HttpNotFound());
            }
            return(View(meeting));
        }