예제 #1
0
        public IEnumerable <UserDto> GetUsers([FromQuery] DateRangeFilterDto filter)
        {
            var internalFitler = filterBuilder.Build(filter);
            var users          = usersProvider.GetUsers(internalFitler);
            var result         = users.Select(userDtoBuilder.Build)
                                 .OrderBy(u => u.Name)
                                 .ToArray();

            return(result);
        }
예제 #2
0
        public void Should_ReturnEmpty_WhenNoUsers()
        {
            usersRepositorySetup.Setup(r => r.Query())
            .Returns(new UserDb[0].AsQueryable());

            var filter = new SubmittedAnswersFilter();

            submittedAnswersProviderSetup.Setup(p => p.GetAnswers(filter))
            .Returns(new SubmittedAnswer[0]);

            usersProvider.GetUsers(filter)
            .Should().BeEmpty();
        }
        public async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            logger.LogInformation("Execute user reminder");
            await foreach (var user in usersProvider.GetUsers().WithCancellation(cancellationToken))
            {
                var response = await userRemindResponseGenerator.GetResponse(user);

                await client.SendResponse(user.TelegramId, response);
            }
        }
        public void Initialize()
        {
            _context.Database.EnsureCreated();

            using (var transaction = _context.Database.BeginTransaction())
            {
                _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT [dbo].[Users] ON");

                _context.Users.RemoveRange(_context.Users);
                _context.Users.AddRange(_usersProvider.GetUsers());
                _context.SaveChanges();

                _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT [dbo].[Users] OFF");

                transaction.Commit();
            }
        }
예제 #5
0
 Task <IEnumerable <IUser> > IUsersService.GetUsersAsync()
 {
     return(Task.Run(() => _usersProvider.GetUsers().Select(x => x.ToEntity())));
 }
 public async Task <List <User> > GetUsers()
 {
     return(await _usersProvider.GetUsers());
 }