public void SetStaticProp(int id, string eventName, string categoryName)
        {
            var helper = new Helper.Functions.HelperFunctions();

            ParticipantId = id;
            EventName     = eventName;

            var attrs = helper.getEnumDisplayAnnotaion((AgeGroup)Enum.Parse(typeof(AgeGroup), categoryName),
                                                       (int)Enum.Parse(typeof(AgeGroup), categoryName));

            categoryName = ((DisplayAttribute)attrs[0]).Name;

            CategoryName = categoryName;
        }
        public ActionResult Payment(string id, string stripeToken)
        {
            var userId      = User.Identity.GetUserId();
            var helper      = new Helper.Functions.HelperFunctions();
            var participant = _unitOfWork.Participants.GetParticipantById(Convert.ToInt32(id));

            if (participant.UserId == userId && participant.paid == false)
            {
                try
                {
                    // make payment
                    var Charge = new StripeChargeCreateOptions();

                    Charge.Amount      = 9000;
                    Charge.Currency    = "usd";
                    Charge.Description = Convert.ToString(participant.Id) + " " + participant.FirstName + " " + participant.LastName;
                    Charge.SourceTokenOrExistingSourceId = stripeToken;
                    Charge.Capture = true;

                    var          chargeService = new StripeChargeService();
                    StripeCharge stripeCharge  = chargeService.Create(Charge);

                    // set participant's paid prop. to true
                    _unitOfWork.Receipts.PurchaseMade(participant.Id, 90.00, DateTime.Now);
                    _unitOfWork.Participants.ParticipantPaid(participant.Id);
                    _unitOfWork.Complete();

                    // send receipt with thank you email
                    helper.SendEmailNotification(User.Identity.GetUserName(), string.Format("{0} {1}", participant.FirstName, participant.LastName));

                    return(RedirectToAction("Transaction", new { TransactionMade = true, id = id }));
                }
                catch (StripeException ex)
                {
                    return(RedirectToAction("Transaction", new { TransactionMade = false, id = id, error = ex.Message }));
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Transaction", new { TransactionMade = true, id = id }));
                }
            }

            return(View("Index"));
        }