public ResponseModel <PolicyDTO> GetPolicyById(string id)
        {
            var result = new ResponseModel <PolicyDTO>();

            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException(string.Empty, MessageValues.ARGUMENT_NULL);
            }

            var policies = _policiesRepository.GetData();
            var policy   = policies.Models.SingleOrDefault(p =>
                                                           string.Equals(p.IdPolicy, id, StringComparison.InvariantCultureIgnoreCase));

            if (policy == null)
            {
                result.NotValidResponse(string.Format(MessageValues.POLICY_NOT_FOUND, nameof(id), id));

                return(result);
            }

            result.IsValid = true;
            result.Model   = (PolicyDTO) new PolicyDTO().InjectFrom(policy);

            return(result);
        }
        public ResponseModel <ClientDTO> GetClientByIdPolicy(string idPolicy)
        {
            var result = new ResponseModel <ClientDTO>();

            if (string.IsNullOrEmpty(idPolicy))
            {
                throw new ArgumentNullException(string.Empty, MessageValues.ARGUMENT_NULL);
            }

            var politicyDTO = _policiesService.GetPolicyById(idPolicy);

            if (!politicyDTO.IsValid)
            {
                result.NotValidResponse(politicyDTO.Message);

                return(result);
            }

            return(GetClientById(politicyDTO.Model.IdClient));
        }
        public ResponseModel <ClientDTO> GetClientByName(string name)
        {
            var result = new ResponseModel <ClientDTO>();

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(string.Empty, MessageValues.ARGUMENT_NULL);
            }

            var clients = _clientsRepository.GetData();
            var client  = clients.Models.SingleOrDefault(c => string.Equals(c.Name, name, StringComparison.InvariantCultureIgnoreCase));

            if (client == null)
            {
                result.NotValidResponse(string.Format(MessageValues.CLIENT_NOT_FOUND, nameof(name), name));

                return(result);
            }

            result.IsValid = true;
            result.Model   = (ClientDTO) new ClientDTO().InjectFrom(client);

            return(result);
        }