Example #1
0
        public void DisburseClaim(DisburseClaim command, IElectionsReadModel electionsReadModel)
        {
            var         elections = electionsReadModel.GetElectionsForParticipant(command.ParticipantId);
            ElectionDto election  = null;

            if (TryGetElection(elections, _state.ClaimType, out election))
            {
                var electionBalance = electionsReadModel.GetElectionBalance(election.Id).BalanceRemaining;
                if (electionBalance - _state.ClaimAmount.Amount < 0)
                {
                    RaiseClaimNotDisbursedEvent(command,
                                                string.Format(
                                                    "Your remaining election balance is {0} which is not enough to cover your claim for {1}",
                                                    electionBalance, _state.ClaimAmount.Amount));
                    return;
                }
                RaiseClaimDisbursedEvent(command, election.Id);
            }
            else
            {
                RaiseClaimNotDisbursedEvent(command, string.Format("No election matches the claim type '{0}'", _state.ClaimType));
            }
        }
 public void DisburseClaim(DisburseClaim command, IElectionsReadModel electionsReadModel)
 {
     var elections = electionsReadModel.GetElectionsForParticipant(command.ParticipantId);
     ElectionDto election = null;
     
     if (TryGetElection(elections, _state.ClaimType, out election))
     {
         var electionBalance = electionsReadModel.GetElectionBalance(election.Id).BalanceRemaining;
         if (electionBalance - _state.ClaimAmount.Amount < 0)
         {
             RaiseClaimNotDisbursedEvent(command,
                                         string.Format(
                                             "Your remaining election balance is {0} which is not enough to cover your claim for {1}",
                                             electionBalance, _state.ClaimAmount.Amount));
             return;
         }
         RaiseClaimDisbursedEvent(command, election.Id);
     }
     else
     {
         RaiseClaimNotDisbursedEvent(command, string.Format("No election matches the claim type '{0}'", _state.ClaimType));
     }
 }
Example #3
0
        //
        // GET: /Elections/

        public ActionResult Index()
        {
            var elections = _electionsReadModel.GetElectionsForParticipant(MvcApplication.ParticipantId);

            return(View(elections));
        }