Exemple #1
0
        protected async Task UserBumpAccountRevisionDateByCipherId(Cipher cipher)
        {
            var list = new List <Cipher> {
                cipher
            };

            await UserBumpAccountRevisionDateByCipherId(list);
        }
Exemple #2
0
        public async Task <PagedResult <IEvent> > GetManyByCipherAsync(Cipher cipher, DateTime startDate, DateTime endDate, PageOptions pageOptions)
        {
            DateTime?beforeDate = null;

            if (!string.IsNullOrWhiteSpace(pageOptions.ContinuationToken) &&
                long.TryParse(pageOptions.ContinuationToken, out var binaryDate))
            {
                beforeDate = DateTime.SpecifyKind(DateTime.FromBinary(binaryDate), DateTimeKind.Utc);
            }
            using (var scope = ServiceScopeFactory.CreateScope())
            {
                var dbContext = GetDatabaseContext(scope);
                var query     = new EventReadPageByCipherIdQuery(cipher, startDate, endDate, beforeDate, pageOptions);
                var events    = await query.Run(dbContext).ToListAsync();

                var result = new PagedResult <IEvent>();
                if (events.Any() && events.Count >= pageOptions.PageSize)
                {
                    result.ContinuationToken = events.Last().Date.ToBinary().ToString();
                }
                result.Data.AddRange(events);
                return(result);
            }
        }