Пример #1
0
        private Invest.Domain.Models.Ticker ConvertToModel(TickerDto tickerDto)
        {
            var ticker = new Invest.Domain.Models.Ticker();

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

            return ticker;
        }
Пример #2
0
        public bool SaveTicker(TickerDto tickerDto)
        {
            var context = new InvestContext();
            //var tickerDto = new TickerDto();
               //var ticker = context.Tickers.FirstOrDefault(p => p.Id == id);

            //foreach (var ticker in tickers)
            //{
               // var tickerModel = ConvertToModel(tickerDto);
            //    tickerDtos.Add(tickerDto);
            //}

               // var id = Int32.Parse(ticker.Id);
            var Ticker = context.Tickers.FirstOrDefault(p => p.Id == tickerDto.Id);

            Ticker.Name = tickerDto.Name;
            Ticker.Symbol = tickerDto.Symbol;
            Ticker.Active = tickerDto.Active;
            Ticker.BCFirstDate = tickerDto.BCFirstDate;
            Ticker.BH = tickerDto.BH;
            Ticker.CBSFirstDate = tickerDto.CBSFirstDate;
            Ticker.Comments = tickerDto.Comments;
            Ticker.component = tickerDto.component;
            Ticker.current = tickerDto.current;
            Ticker.DateAdded = tickerDto.DateAdded;
            Ticker.DateModified = tickerDto.DateModified;
            Ticker.endDate = tickerDto.endDate;
            Ticker.FirstBuy = tickerDto.FirstBuy;
            Ticker.InceptionDate = tickerDto.InceptionDate;
            Ticker.LastSell = tickerDto.LastSell;
            Ticker.MCFirstDate = tickerDto.MCFirstDate;
            Ticker.priceDecimal = tickerDto.priceDecimal;
            // public System.Data.Objects.DataClasses.EntityCollection<Sell> Sells { get; set; }
            Ticker.shareDecimal = tickerDto.shareDecimal;
            Ticker.startDate = tickerDto.startDate;
            Ticker.TickerBC = tickerDto.TickerBC;
            Ticker.TickerBH = tickerDto.TickerBH;
            Ticker.tickerGUID = tickerDto.tickerGUID;
            Ticker.TickerYahoo = tickerDto.TickerYahoo;
            Ticker.type = tickerDto.Type;
            context.SaveChanges();
            return true;
        }
Пример #3
0
        private TickerDto ConvertToDto(Invest.Domain.Models.AccountTicker accountTicker)
        {
            var tickerDto = new TickerDto();

            tickerDto.Symbol = accountTicker.Ticker1.Symbol;
            tickerDto.Id = accountTicker.TickerId;
            tickerDto.Name = accountTicker.Ticker1.Name;
            tickerDto.Type = accountTicker.Ticker1.type;

            return tickerDto;
        }