public IActionResult EditAnalysis(EditFormsViewModel model) { var analysis = _analysisService.GetAnalysis(model.ID); if (ModelState.IsValid) { analysis.StrategyPicked = model.StrategyPicked; analysis.StrategyPicked = model.StrategyPicked; analysis.TradingCriteria = model.TradingCriteria; analysis.ExitStrategy = model.ExitStrategy; analysis.TradingTrend = model.TradingTrend; analysis.AcceptanceType = model.AcceptanceType; analysis.RewardRatio = model.RewardRatio; analysis.DescribeTrade = model.DescribeTrade; analysis.PairPicked = model.PairPicked; analysis.MentalState = model.MentalState; analysis.TradeStatus = model.TradeStatus; analysis.TradeOutcome = model.TradeOutcome; analysis.MetDailyGoal = model.MetDailyGoal; analysis.ExplainTrade = model.ExplainTrade; analysis.Note = model.Note; analysis.TimeOfTrade = model.TimeOfTrade; _analysisStore.Update(analysis); return(RedirectToAction("index", "analysis")); } return(View()); }
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)); }