示例#1
0
        public int AggiornaQuotePortafoglio(string ticker, List <QuotaPortafoglio> quote)
        {
            if (!quote.Any())
            {
                return(0);
            }

            var quoteEsistenti = _tradingContext.QuotePortafoglio.Where(q => q.Ticker == ticker).ToList();

            foreach (var quota in quote)
            {
                if (!quoteEsistenti.Any(q => q.Ticker == quota.Ticker && q.Data == quota.Data))
                {
                    _tradingContext.QuotePortafoglio.Add(quota);
                }
            }
            return(_tradingContext.SaveChanges());
        }
示例#2
0
 public void RemoveFromSelection(string ticker)
 {
     _tradingContext.Attach(new Selezione { Ticker = ticker }).State = EntityState.Deleted;
     _tradingContext.SaveChanges();
 }
示例#3
0
 public int Add(Quota quota)
 {
     _tradingContext.Quote.Add(quota);
     return(_tradingContext.SaveChanges());
 }