Defensive FirstOrDefault

This commit is contained in:
Robert McRackan 2021-10-21 15:39:53 -04:00
parent d636ceed8e
commit 0a986238bc

View File

@ -68,7 +68,7 @@ namespace DtoImporterService
foreach (var item in importItems)
{
var book = DbContext.Books.Local.SingleOrDefault(p => p.AudibleProductId == item.DtoItem.ProductId);
var book = DbContext.Books.Local.FirstOrDefault(p => p.AudibleProductId == item.DtoItem.ProductId);
if (book is null)
{
book = createNewBook(item);