예제 #1
0
 public void DeleteInvestmentList(InvestmentWatchlistModel watchlist)
 {
     using (var context = _contextProvider.GetContext())
     {
         var watchlistToDelete = context.InvestmentWatchlists.Single(wl => wl.Id == watchlist.Id);
         context.InvestmentWatchlists.Remove(watchlistToDelete);
         context.Save();
     }
     Watchlists.Remove(watchlist);
     if (Watchlists.Any())
     {
         SelectedWatchlist = Watchlists.Last();
     }
 }
예제 #2
0
 public void AddInvestmentList()
 {
     InvestmentWatchlistModel newWatchlist = new InvestmentWatchlistModel
     {
         Name = InvestmentListName,
         Description = InvestmentListDescription
     };
     using (var context = _contextProvider.GetContext())
     {
         context.InvestmentWatchlists.Add(newWatchlist);
         context.Save();
         newWatchlist.Id = context.InvestmentWatchlists.ToList().Last().Id;
     }
     Watchlists.Add(newWatchlist);
 }