Example #1
0
        public async Task <IServiceResult> GetAllAsync(QueryObject queryTerm)
        {
            try
            {
                var shippings = queryTerm != null
                    ? _repository.SortAndFilterAsync(queryTerm).Result.Items
                    : await _repository.GetAllAsync();

                var shippingsDto = _mapper.Map <IEnumerable <Shipping>, IEnumerable <ShippingDto> >(shippings);

                return(new ServiceResult(payload: shippingsDto));
            }
            catch (Exception e)
            {
                _logger.LogError($"Getting all shippings failed. {e.Message}");

                return(new ServiceResult(false, e.Message));
            }
        }