Removed unnecessary conversion to List.

This commit is contained in:
Michael Bucari-Tovo 2021-07-02 13:50:18 -06:00
parent fbf92bf151
commit 5d4bcb2db0
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ namespace DtoImporterService
new CategoryImporter(DbContext).Import(importItems);
// get distinct
var productIds = importItems.Select(i => i.DtoItem.ProductId).ToList();
var productIds = importItems.Select(i => i.DtoItem.ProductId);
// load db existing => .Local
loadLocal_books(productIds);
@ -31,7 +31,7 @@ namespace DtoImporterService
return qtyNew;
}
private void loadLocal_books(List<string> productIds)
private void loadLocal_books(IEnumerable<string> productIds)
{
var localProductIds = DbContext.Books.Local.Select(b => b.AudibleProductId);
var remainingProductIds = productIds

View File

@ -34,8 +34,8 @@ namespace DtoImporterService
//
// CURRENT SOLUTION: don't re-insert
var currentLibraryProductIds = DbContext.Library.Select(l => l.Book.AudibleProductId).ToList();
var newItems = importItems.Where(dto => !currentLibraryProductIds.Contains(dto.DtoItem.ProductId)).ToList();
var currentLibraryProductIds = DbContext.Library.Select(l => l.Book.AudibleProductId);
var newItems = importItems.Where(dto => !currentLibraryProductIds.Contains(dto.DtoItem.ProductId));
foreach (var newItem in newItems)
{
@ -55,7 +55,7 @@ namespace DtoImporterService
u.UpdateAccount(item.AccountId);
}
var qtyNew = newItems.Count;
var qtyNew = newItems.Count();
return qtyNew;
}
}