예제 #1
0
        public async Task <IActionResult> GetAnalysis(int id)
        {
            var analysis = await _analysisService.GetAnalysis(id);

            var data = _mapper.Map <AnalysisViewModel>(analysis);

            return(new OkObjectResult(new ApiResponse <AnalysisViewModel>("Analysis was found.", data)));
        }
예제 #2
0
        public IActionResult EditAnalysis(Guid id)
        {
            var userid      = User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier).Value;
            var currentUser = _traderStore.GetAll().FirstOrDefault(u => u.TraderId == Guid.Parse(userid));


            var strategy = _context.Strategies.Where(s => s.TraderId == currentUser.TraderId).ToList();

            strategy.Insert(0, new Strategy
            {
                Name = "Select a strategy "
            });

            ViewBag.Strategies = strategy;


            var exitStrategies = _context.ExitStrategies.Where(s => s.TraderId == currentUser.TraderId).ToList();

            exitStrategies.Insert(0, new ExitStrategy
            {
                Name = "Select an exit strategy"
            });

            ViewBag.ExitStrategies = exitStrategies;



            var pairs = _context.Pairs.Where(s => s.TraderId == currentUser.TraderId).ToList();

            pairs.Insert(0, new Pair
            {
                Currencies = "Select a pair",
            });
            ViewBag.Pair = pairs;



            var analysis = _analysisService.GetAnalysis(id);

            ViewBag.id = id;

            var editForms = new EditFormsViewModel()
            {
                StrategyPicked  = analysis.StrategyPicked,
                TradingCriteria = analysis.TradingCriteria,
                ExitStrategy    = analysis.ExitStrategy,
                TradingTrend    = analysis.TradingTrend,
                AcceptanceType  = analysis.AcceptanceType,
                RewardRatio     = analysis.RewardRatio,
                DescribeTrade   = analysis.DescribeTrade,
                PairPicked      = analysis.PairPicked,
                MentalState     = analysis.MentalState,
                TradeStatus     = analysis.TradeStatus,
                TradeOutcome    = analysis.TradeOutcome,
                ExplainTrade    = analysis.ExplainTrade,
                Note            = analysis.Note,
                TimeOfTrade     = analysis.TimeOfTrade,
                MetDailyGoal    = analysis.MetDailyGoal,
            };

            return(View(editForms));
        }