public override async Task Execute() { var query = Session.Query <MeetingMaster, MeetingIndex>() .ProjectInto <MeetingMaster>() .Statistics(out QueryStatistics stats) .Take(Filter.Take) .Skip(Filter.Skip * Filter.Take) .OrderByDescending(a => a.DateModified); if (Filter.DateFrom > DateTime.MinValue || Filter.DateTo > DateTime.MaxValue) { query = query.Where(v => v.When > Filter.DateFrom && v.When < Filter.DateTo); } if (Filter.ParticipantKeys.Any()) { query = query.Where(u => u.Participants.In(Filter.ParticipantKeys)); } query = await Init(query, Filter, "meeting"); Result = await MeetingDisplayProjection.Transform(query).ToListAsync(); Process(Filter, stats); }
public override async Task Execute() { var meetingQuery = MeetingDisplayProjection .Transform(Session.Query <MeetingMaster, MeetingIndex>().Where(c => c.Id == Id)).Take(1).LazilyAsync(); var favQuery = Session.Query <FavMaster, FavFanIndex>().Where(c => c.Id == Id).CountLazilyAsync(); var meetingResult = await meetingQuery.Value; var favResult = await favQuery.Value; Result = meetingResult.FirstOrDefault(); Result.Favourite = favResult > 0; }
public override async Task Execute() { Result = new StatsDisplay() { Name = CurrentUser.TenantName, Id = CurrentUser.TenantId }; var meetingQuery = Session.Query <MeetingMaster, MeetingIndex>() .ProjectInto <MeetingMaster>() .Take(128) .Skip(0) .Where(a => a.When > DateHelper.FormatDayStart(DateTime.UtcNow.AddDays(-Back)) && a.When < DateHelper.FormatDayEnd(DateTime.UtcNow) && a.TenantId == CurrentUser.TenantId) .OrderByDescending(a => a.DateModified); var meetingResult = MeetingDisplayProjection.Transform(meetingQuery).LazilyAsync(); var msgQuery = Session.Query <MsgMaster, MsgIndex>() .ProjectInto <MsgMaster>() .Take(5) .Skip(0) .Where(m => m.DateCreated > DateHelper.FormatDayStart(DateTime.UtcNow.AddDays(-Back)) && m.TenantId == CurrentUser.TenantId) .OrderByDescending(a => a.DateModified); var msgResult = MsgDisplayTrans.Transform(msgQuery).LazilyAsync(); var tenantQuery = TenantStatProjection .Transform(Session.Query <TenantStat, TenantStatIndex>().Where(c => c.Id == CurrentUser.TenantId)) .Take(1).LazilyAsync(); var tenantResult = await tenantQuery.Value; Result.Meetings = await meetingResult.Value; Result.Msgs = await msgResult.Value; Result.Tenant = tenantResult.FirstOrDefault(); }