예제 #1
0
        public StrategyForDisplay GetStrategyForDisplay(int strategyId)
        {
            Strategy           strategy           = _strategyService.GetById(strategyId);
            StrategyForDisplay strategyForDisplay = ToDisplayViewModel(strategy);

            return(strategyForDisplay);
        }
예제 #2
0
        public StrategyForDisplay GetById(int id)
        {
            StrategyForDisplay strategy = _strategiesOrchestrator.GetStrategyForDisplay(id);

            if (strategy == null)
            {
                ThrowNotFoundException();
            }
            return(strategy);
        }
예제 #3
0
        private StrategyForDisplay ToDisplayViewModel(Strategy strategy)
        {
            StrategyForDisplay viewModel = Mapper.Map <Strategy, StrategyForDisplay>(strategy);

            if (strategy != null && strategy.PairStrategyId.HasValue)
            {
                Strategy pairStrategy = _strategyService.GetById(strategy.PairStrategyId.Value);
                if (pairStrategy == null)
                {
                    throw new Exception("Pair Strategy has not been found.");
                }
                viewModel.PairStrategyName = pairStrategy.Name;
            }

            return(viewModel);
        }