/// <summary>
        /// calculate result for individual investment option
        /// </summary>
        /// <param name="investmentOptionDto"></param>
        /// <returns></returns>
        public CalculationModel CalculateROIAndFeeForOption(InvestmentOptionDto investmentOptionDto)
        {
            var interestCalculationStrategy   = _calculationStrategyFactory.GetCalculationStrategy(investmentOptionDto.InvestmentOption);
            CalculationModel calculationModel = new CalculationModel
            {
                ROI = interestCalculationStrategy.CalculateROI(investmentOptionDto.InvestmentPercentage, investmentOptionDto.InvestmentAmount)
            };

            calculationModel.Fee = interestCalculationStrategy.CalculateFee(investmentOptionDto.InvestmentPercentage, calculationModel.ROI);
            return(calculationModel);
        }
Exemplo n.º 2
0
        public List <InvestmentOptionDto> FromCalculateROIRequestToInvestmentOptionDtos(CalculateROIRequest requestModel)
        {
            List <InvestmentOptionDto> investmentOptionDtos = new List <InvestmentOptionDto>();

            foreach (var option in requestModel.Options)
            {
                InvestmentOptionDto investmentOptionDto = new InvestmentOptionDto
                {
                    InvestmentOption     = option.InvestmentOption,
                    InvestmentPercentage = option.InvestmentPercentage,
                    InvestmentAmount     = _investmentOptionService.CalculateInvestmentAmount(requestModel.TotalAmount, option.InvestmentPercentage)
                };
                investmentOptionDtos.Add(investmentOptionDto);
            }
            return(investmentOptionDtos);
        }