public async Task <ApiListResponse <LanguageDisplayModel> > Search(int skip, int limit, string q)
        {
            var result = new ApiListResponse <LanguageDisplayModel>(skip, limit);

            var list = await _languageRepository.Search(skip, limit, q);

            var total = await _languageRepository.Count();

            result.Data  = list?.Select(x => _mapper.Map <LanguageDisplayModel>(x)).ToList();
            result.Total = total;

            return(result);
        }
Exemplo n.º 2
0
        public void Can_Perform_Count_On_LanguageRepository()
        {
            // Arrange
            var provider   = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new LanguageRepository(unitOfWork);

            // Act
            var query = Query <ILanguage> .Builder.Where(x => x.IsoCode.StartsWith("D"));

            int count = repository.Count(query);

            // Assert
            Assert.That(count, Is.EqualTo(2));
        }
Exemplo n.º 3
0
        public void Can_Perform_Count_On_LanguageRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                LanguageRepository repository = CreateRepository(provider);

                // Act
                IQuery <ILanguage> query = provider.CreateQuery <ILanguage>().Where(x => x.IsoCode.StartsWith("D"));
                int count = repository.Count(query);

                // Assert
                Assert.That(count, Is.EqualTo(2));
            }
        }
        public void Can_Perform_Count_On_LanguageRepository()
        {
            // Arrange
            var provider = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new LanguageRepository(unitOfWork);

            // Act
            var query = Query<ILanguage>.Builder.Where(x => x.IsoCode.StartsWith("D"));
            int count = repository.Count(query);

            // Assert
            Assert.That(count, Is.EqualTo(2));
        }