Return newest item when scanning barcode linked to multiple items

This commit is contained in:
James Chapman 2023-11-12 19:34:06 +00:00
parent cd77aaf313
commit fce7734df6
Signed by: jamsch0
GPG Key ID: 765FE58130277547

View File

@ -111,6 +111,7 @@ public class TransactionsController : Controller
{
var item = await dbContext.Items
.Where(item => item.Barcodes.Any(barcode => barcode.BarcodeData == barcodeData))
.OrderByDescending(item => item.UpdatedAt)
.FirstOrDefaultAsync();
item ??= new Item(id: default);