public static async Task SaveItems(List <RssItemModel> items) { using (var context = new NCoreDownloaderContext()) { foreach (var item in items) { await context.RssItems.AddIfNotExists(item, i => i.Id == item.Id); } await context.SaveChangesAsync(); } }
public static async Task SaveSessionId(string sessionId) { using (var context = new NCoreDownloaderContext()) { //korábbi cookie törlése var data = await context.QBitTorrentData.ToListAsync(); context.QBitTorrentData.RemoveRange(data); var entity = new QBitTorrentData() { SessionId = sessionId }; context.QBitTorrentData.Add(entity); await context.SaveChangesAsync(); } }