Exemplo n.º 1
0
        public ClaimDomainModel GetById(Guid id)
        {
            var claim = GetClaimInteractor.Execute(id);

            if (claim == null)
            {
                throw new ArgumentException("Claim does not exist");
            }

            return(new ClaimDomainModel(claim));
        }
Exemplo n.º 2
0
        public ClaimDomainModel ViewClaim(Guid policyId)
        {
            var policy = GetPolicyInteractor.GetById(policyId);

            if (policy == null)
            {
                throw new ArgumentException("There is no policy for that ID.");
            }

            var existingClaim = GetClaimInteractor.Execute(policyId);

            // returns new claim model regardless
            // will eventually need to return existing claim data or error handle
            return(new ClaimDomainModel(existingClaim));
        }
Exemplo n.º 3
0
        // did a total overhaul on this, I don't think it matches the video
        public ClaimDomainModel StartClaim(Guid policyId)
        {
            var policy = GetPolicyInteractor.GetById(policyId);

            if (policy == null)
            {
                throw new ArgumentException("There is no policy for that ID.");
            }

            // Check for existing claim
            var existingClaimEntity = GetClaimInteractor.Execute(policyId);

            // if there's an existing claim, return it. If not, create one.
            if (existingClaimEntity != null)
            {
                return(new ClaimDomainModel(existingClaimEntity));
            }
            else
            {
                var newClaimEntity = CreateClaimInteractor.Excute(policyId);
                return(new ClaimDomainModel(newClaimEntity));
            }
        }