コード例 #1
0
ファイル: TickerController.cs プロジェクト: dcmuir01/Invest
        public ActionResult Create(TickerViewModel viewModel)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #2
0
ファイル: TickerController.cs プロジェクト: dcmuir01/Invest
        private Invest.Web.Models.TickerViewModel ConvertToViewModel(Invest.BusinessLogic.Service.Contract.Dto.TickerDto ticker)
        {
            var tickerModel = new Invest.Web.Models.TickerViewModel();

            tickerModel.Active = ticker.Active;
            tickerModel.BCFirstDate = ticker.BCFirstDate;
            tickerModel.BH = ticker.BH;
            // public System.Data.Objects.DataClasses.EntityCollection<Buy> Buys { get; set; }
            tickerModel.CBSFirstDate = ticker.CBSFirstDate;
            tickerModel.Comments = ticker.Comments;
            tickerModel.component = ticker.component;
            tickerModel.current = ticker.current;
            tickerModel.DateAdded = ticker.DateAdded;
            tickerModel.DateModified = ticker.DateModified;
            tickerModel.endDate = ticker.endDate;
            tickerModel.FirstBuy = ticker.FirstBuy;
            tickerModel.Id = ticker.Id;
            tickerModel.InceptionDate = ticker.InceptionDate;
            tickerModel.LastSell = ticker.LastSell;
            tickerModel.MCFirstDate = ticker.MCFirstDate;
            tickerModel.Name = ticker.Name;
            tickerModel.priceDecimal = ticker.priceDecimal;
            // public System.Data.Objects.DataClasses.EntityCollection<Sell> Sells { get; set; }
            tickerModel.shareDecimal = ticker.shareDecimal;
            tickerModel.startDate = ticker.startDate;
            tickerModel.Symbol = ticker.Symbol;
            tickerModel.TickerBC = ticker.TickerBC;
            tickerModel.TickerBH = ticker.TickerBH;
            tickerModel.tickerGUID = ticker.tickerGUID;
            tickerModel.TickerYahoo = ticker.TickerYahoo;
            tickerModel.Type = ticker.Type ?? "";

            return tickerModel;
        }
コード例 #3
0
        public ActionResult Tickers()
        {
            var context = new InvestContext();
            var query = context.Quest401KTransactions.Select(p => new { p.Ticker, p.Trantype }).Distinct().ToList();

            var tickersViewModel = new TickersViewModel { Tickers = new List<TickerViewModel>() };
            foreach (var _ticker in query)
            {
                var ticker = new TickerViewModel();
                ticker.Symbol  =  _ticker.Ticker;
                ticker.Name = _ticker.Trantype;

                tickersViewModel.Tickers.Add(ticker);
            }

            return View(tickersViewModel);
        }
コード例 #4
0
ファイル: TickerController.cs プロジェクト: dcmuir01/Invest
        public ActionResult Edit(TickerViewModel viewModel)
        {
            try
            {
                var tickerDto = ConvertToDto(viewModel);

                var success = _tickerService.SaveTicker(tickerDto);

                return RedirectToAction("Index");
            }
            catch
            {
                return View(viewModel);
            }
        }
コード例 #5
0
        public ActionResult Tickers(int id)
        {
            var tickers = _tickerService.GetTickersByAccount(id);
            // var nav = _navService.GetTicker(id);
            var viewModel = new TickersViewModel
            {
                Tickers = new List<TickerViewModel>()
            };
            foreach (var ticker in tickers)
            {
                var TickerViewModel = new TickerViewModel();
                TickerViewModel.Symbol = ticker.Symbol;
                TickerViewModel.Name = ticker.Name;
                TickerViewModel.Id = ticker.Id;
                TickerViewModel.Type = ticker.Type;

                viewModel.Tickers.Add(TickerViewModel);
            }
            return View(viewModel);
        }