コード例 #1
0
        public SimulationRunModel Post([FromRoute] string id)
        {
            var simulationScenario = new SimulationScenario(new IRSTaxFileBuilder(), this.mediator);

            var result = simulationScenario.Run();

            var yearResults = result.Results.
                              Select(i => new YearResultModel
            {
                Movements = i.Movements.Select(mvt => new MovementsModel {
                    ExerciseCost = mvt.ExerciseCost, ShareCost = mvt.ShareCost, ShareValue = mvt.ShareValue, Type = mvt.MovementType == Shares.ShareMovementType.Acquisition ? MovementType.Vesting : MovementType.Selling
                }),
                Year         = i.Year,
                SharesProfit = i.SharesProfit,
                TaxResult    = i.TaxResult
            });

            var shares = new ShareModel
            {
                TotalCount = result.Shares.Count()
            };

            var model = new SimulationRunModel
            {
                SimulationId    = id,
                FamilyAggregate = result.Aggregate,
                YearResults     = yearResults,
                Shares          = shares,
                TotalGains      = result.TotalProfit
            };

            return(model);
        }
コード例 #2
0
        public IActionResult Post([FromRoute] string id)
        {
            var simulationScenario = new SimulationScenario(new IRSTaxFileBuilder(), this.mediator);

            var result = simulationScenario.Run();

            var yearResults = result.Results.
                              Select(i => new YearResultModel
            {
                Movements    = Adapt(i.Movements),
                Year         = i.Year,
                SharesProfit = i.SharesProfit,
                TaxResult    = i.TaxResult
            });

            var shares = new ShareModel
            {
                TotalCount = result.Shares.Count()
            };

            var model = new SimulationResultsModel
            {
                SimulationId = id,
                YearResults  = yearResults,
                Shares       = shares,
                TotalGains   = result.TotalProfit,
                SharesIncome = result.Results.Sum(i => i.SharesProfit),
                TotalTaxes   = result.Results.Sum(i => i.TaxResult.TaxSettling)
            };

            return(this.Ok(model));
        }
コード例 #3
0
        private int ShowOptions(ShowOptions opts)
        {
            var baseScenario = new SimulationScenario(new IRSTaxFileBuilder(), this.mediator);

            var baseResult = baseScenario.Run();

            baseResult.Display();

            return(1);
        }