SHA256
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user