public ResponseModels <Client> GetData()
        {
            var result  = new ResponseModels <Client>();
            var clients = ResourcesHandler.Load <Client>(AddressValues.CLIENTS, TableNameValues.CLIENTS);

            if (!clients.Any())
            {
                result.NotValidResponse(MessageValues.CLIENTS_REPOSITORY_EMPTY);

                return(result);
            }

            result.IsValid = true;
            result.Models  = clients.Select(c => (Client) new Client().InjectFrom(c));

            return(result);
        }
        public ResponseModels <Policy> GetData()
        {
            var result   = new ResponseModels <Policy>();
            var policies = ResourcesHandler.Load <Policy>(AddressValues.POLICIES, TableNameValues.POLICIES);

            if (!policies.Any())
            {
                result.NotValidResponse(MessageValues.POLICIES_REPOSITORY_EMPTY);

                return(result);
            }

            result.IsValid = true;
            result.Models  = policies.Select(c => (Policy) new Policy().InjectFrom(c));

            return(result);
        }
        public ResponseModels <PolicyDTO> GetPoliciesLinkedByName(string name)
        {
            var result = new ResponseModels <PolicyDTO>();

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

            var clientDTO = GetClientByName(name);

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

                return(result);
            }

            return(_policiesService.GetPoliciesLinkedByIdClient(clientDTO.Model.IdClient));
        }
        public ResponseModels <PolicyDTO> GetPoliciesLinkedByIdClient(string idClient)
        {
            var result = new ResponseModels <PolicyDTO>();

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

            var policies       = _policiesRepository.GetData();
            var policiesLinked = policies.Models.Where(p => p.IdClient == idClient);

            if (!policiesLinked.Any())
            {
                result.NotValidResponse(MessageValues.CLIENT_NOT_LINKED_POLICIES);

                return(result);
            }

            result.IsValid = true;
            result.Models  = policiesLinked.Select(pl => (PolicyDTO) new PolicyDTO().InjectFrom(pl));

            return(result);
        }