GuestLog - StayEntry pages fixes

- Details/New - Fixed time field binding. Now it binds directly to the Model instead of using temp TimeSpans.
- New - Fixed StayEntry validation to allow creating Stays with a DateOut in the past.
- List - Added ordering to db results so limit behaves in a deterministic way. Fixed default search so stays created today are shown.
This commit is contained in:
2026-08-24 20:50:38 +02:00
parent 511bd023f2
commit b18bd7caa6
8 changed files with 67 additions and 29 deletions
@@ -153,12 +153,15 @@ public class StayEntryService(
query = query.WhereIf(!string.IsNullOrEmpty(filter.PaymentMethod),
e => e.PaymentMethod == filter.PaymentMethod);
query = query.OrderByDescending(e => e.DateIn);
if (limit > 0)
{
query = query.Take(limit);
}
var dbList = await query.ToListAsync();
var dbList = await query
.ToListAsync();
return dbList.Select(x => GetDtoFromDb(x, queryConfig));
}
@@ -183,6 +186,7 @@ public class StayEntryService(
var rs = await dbContext.StayEntries
.Where(s => s.GuestDocuments.Any(g => g.DocumentType == docType && g.DocumentNum == docNum))
.AddQueryConfig(queryConfig)
.OrderByDescending(e => e.DateIn)
.ToListAsync();
return rs.Select(e => GetDtoFromDb(e, queryConfig));