Esempio n. 1
0
        public void Handle(ClaimApprovedCommand command)
        {
            var existingClaim = queryService.GetClaim(command.ClaimNo);

            if (null == existingClaim)
            {
                throw new Exception("Missing Claim " + command.ClaimNo);
            }

            var claim = new Claim();

            claim.ApproveClaim(existingClaim.ClaimId, command.ClaimNo, command.ApprovedBy);
            commandService.ApproveClaim(command);
            _eventStoreRepository.Save(claim, -1);

            // Throwing event in Aggregate, not in CommandHandler.
            // _eventPublisher.Publish(new Events.ClaimApprovedEvent(command.ClaimNo, command.ApprovedBy, command.ApprovedDate));
        }