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()); }
public void RemoveFromSelection(string ticker) { _tradingContext.Attach(new Selezione { Ticker = ticker }).State = EntityState.Deleted; _tradingContext.SaveChanges(); }
public int Add(Quota quota) { _tradingContext.Quote.Add(quota); return(_tradingContext.SaveChanges()); }