public async Task <IActionResult> GetInvestments([FromQuery] InvestmentParams investmentParams)
        {
            var investments = await _repo.GetInvestments(investmentParams);

            var dtoToReturn = _mapper.Map <IEnumerable <InvestmentDto> >(investments);

            Response.AddPagination(investments.CurrentPage, investments.PageSize,
                                   investments.TotalCount, investments.TotalPages);

            return(Ok(dtoToReturn));
        }
        public async Task <PagedList <Investment> > GetInvestments(InvestmentParams investmentParams)
        {
            var investments = _context.Investments
                              .OrderBy(i => i.InvestmentCode)
                              .AsQueryable();

            if (!string.IsNullOrWhiteSpace(investmentParams.InvestmentCode))
            {
                investments = investments.Where(i =>
                                                i.InvestmentCode.ToLower().StartsWith(investmentParams.InvestmentCode.ToLower()));
            }

            if (!string.IsNullOrWhiteSpace(investmentParams.Market))
            {
                investments = investments.Where(i =>
                                                i.Market.ToLower() == investmentParams.Market.ToLower());
            }

            if (!string.IsNullOrWhiteSpace(investmentParams.Currency))
            {
                investments = investments.Where(i =>
                                                i.Currency.ToLower() == investmentParams.Currency.ToLower());
            }

            if (!string.IsNullOrWhiteSpace(investmentParams.OrderBy))
            {
                switch (investmentParams.OrderBy)
                {
                case "price":
                    investments = investments.OrderByDescending(i => i.Price);
                    break;

                case "updated":
                    investments = investments.OrderByDescending(i => i.PriceUpdatedUtc);
                    break;

                default:
                    investments = investments.OrderBy(i => i.InvestmentCode);
                    break;
                }
            }

            return(await PagedList <Investment> .CreateAsync(
                       investments,
                       investmentParams.PageNumber,
                       investmentParams.PageSize
                       ));
        }