This commit is contained in:
2020-04-10 18:38:32 +00:00
parent 590558362c
commit b46b9dcf72
2 changed files with 19 additions and 18 deletions

View File

@@ -52,13 +52,9 @@ namespace AyaNova.Biz
var q = ct.Event.Select(m => m).AsNoTracking();
q = q.Where(m => m.AyId == opt.AyId);
if (opt.StartDate != null)
q = q.Where(m => m.Created > opt.StartDate);
if (opt.EndDate != null)
q = q.Where(m => m.Created < opt.EndDate);
q = q.OrderBy(m => m.Created);
var limit = opt.Limit ?? 100;
var offset = opt.Offset ?? 0;
q = q.OrderBy(m => m.Created);
//Execute the query
@@ -82,20 +78,16 @@ namespace AyaNova.Biz
/// Get the event log for a specified User
/// Presentation is the client's responsibility (localization internationalization etc)
/// </summary>
internal static async Task<AyaNova.Api.Controllers.EventLogController.UserEventLogItem[]> GetLogForUserAsync(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
internal static async Task<AyaNova.Api.Controllers.EventLogController.UserEventLogItem[]> GetLogForUserAsync(AyaNova.Api.Controllers.EventLogController.UserEventLogOptions opt, AyContext ct)
{
//Set up the query
var q = ct.Event.Select(m => m);
q = q.Where(m => m.UserId == opt.AyId);
if (opt.StartDate != null)
q = q.Where(m => m.Created > opt.StartDate);
if (opt.EndDate != null)
q = q.Where(m => m.Created < opt.EndDate);
var limit = opt.Limit ?? 100;
var offset = opt.Offset ?? 0;
q = q.OrderBy(m => m.Created);
q.Skip(offset).Take(limit);
//Execute the query
var EventItems = await q.ToArrayAsync();