/// <summary>
        /// Gets all animals asynchronous.
        /// </summary>
        /// <returns>Return a list of animal's information</returns>
        /// <exception cref="ExceptionDto">There was an error getting all the employee charge data.</exception>
        public async Task <ICollection <ZooAnimalDto> > GetAllAnimalsAsync()
        {
            try
            {
                ICollection <ZooAnimalDto> lstAnimaslDto = new List <ZooAnimalDto>();
                var query      = _getAnimalRepository.Get().Include(a => a.AnimalType);
                var lstAnimals = await query.ToListAsync();

                lstAnimaslDto = _imapper.Map <ICollection <Animal>, ICollection <ZooAnimalDto> >(lstAnimals);
                return(lstAnimaslDto);
            }
            catch (Exception ex)
            {
                var guid = Guid.NewGuid();
                _logger.Log(LogLevel.Error, ex, guid.ToString());
                throw new ExceptionDto(guid, "There was an error getting all the animals data.");
            }
        }
示例#2
0
        public T Get <T>(string urlEndPoint)
        {
            try
            {
                if (string.IsNullOrEmpty(_clientName))
                {
                    throw new ArgumentNullException(ErrorClientNameNotSet);
                }

                var result = _dataGetter.Get <T>(_clientName, _headers, urlEndPoint);
                return(result);
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }