Exemplo n.º 1
0
        private void SearchQueryMSetOrderByShouldWork()
        {
            const OrderRule expected = OrderRule.Desc;

            var obj = new SearchQueryM {
                OrderBy = expected.ToString()
            };

            Assert.Equal(expected, obj.OrderByValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stat search method. units
        /// </summary>
        /// <param name = "filter"> Request </param>
        /// <param name = "userId"> User Id </param>
        /// <param name = "isDeleted"> Distance flag </param>
        /// <returns> </returns>
        public async Task <SearchVm> Search(SearchQueryM filter, string userId, bool isDeleted = false)
        {
            await _elasticService.CheckElasticSearchConnection();

            bool isAdmin = await _userService.IsInRoleAsync(userId, DefaultRoleNames.Administrator);

            long totalCount;
            List <ElasticStatUnit> units;

            if (filter.IsEmpty())
            {
                var baseQuery = _dbContext.StatUnitSearchView
                                .Where(s => s.IsDeleted == isDeleted && s.LiqDate == null);

                totalCount = baseQuery.Count();
                units      = (await baseQuery.Skip((filter.Page - 1) * filter.PageSize).Take(filter.PageSize).ToListAsync())
                             .Select(Mapper.Map <StatUnitSearchView, ElasticStatUnit>).ToList();
            }
            else
            {
                var searchResponse = await _elasticService.Search(filter, userId, isDeleted);

                totalCount = searchResponse.TotalCount;
                units      = searchResponse.Result.ToList();
            }

            var finalIds = units.Where(x => x.UnitType != StatUnitTypes.EnterpriseGroup)
                           .Select(x => x.RegId).ToList();
            var finalRegionIds = units.Select(x => x.RegionId).ToList();

            var unitsToPersonNames = await GetUnitsToPersonNamesByUnitIds(finalIds);

            var unitsToMainActivities = await GetUnitsToPrimaryActivities(finalIds);

            var regions = await GetRegionsFullPaths(finalRegionIds);

            var permissions = await _userService.GetDataAccessAttributes(userId, null);

            var helper = new StatUnitCheckPermissionsHelper(_dbContext);
            var result = units
                         .Select(x => new SearchViewAdapterModel(x, unitsToPersonNames[x.RegId],
                                                                 unitsToMainActivities[x.RegId],
                                                                 regions.GetValueOrDefault(x.RegionId)))
                         .Select(x => SearchItemVm.Create(x, x.UnitType,
                                                          permissions.GetReadablePropNames(),
                                                          !isAdmin && !helper.IsRegionOrActivityContains(userId, x.RegionId != null ? new List <int> {
                (int)x.RegionId
            } : new List <int>(), x.ActivityCategoryIds)));

            return(SearchVm.Create(result, totalCount));
        }
Exemplo n.º 3
0
        private async Task GetAll()
        {
            using (var ctx = CreateDbContext())
            {
                var query = new SearchQueryM {
                    Wildcard = "2"
                };
                ctx.DataSources.AddRange(new DataSource {
                    Name = "123"
                }, new DataSource {
                    Name = "234"
                });
                await ctx.SaveChangesAsync();

                var actual = await new DataSourcesService(ctx).GetAllDataSources(query);

                Assert.Equal(2, actual.Result.Count());
            }
        }
Exemplo n.º 4
0
        private async Task GetAllSortBy()
        {
            using (var ctx = CreateDbContext())
            {
                var query = new SearchQueryM
                {
                    SortBy  = nameof(DataSource.Name),
                    OrderBy = OrderRule.Desc.ToString(),
                };
                ctx.DataSources.AddRange(new DataSource {
                    Name = "123"
                }, new DataSource {
                    Name = "234"
                });
                await ctx.SaveChangesAsync();

                var actual = await new DataSourcesService(ctx).GetAllDataSources(query);

                Assert.Equal("234", actual.Result.First()?.Name);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Method for obtaining all data sources
        /// </summary>
        /// <param name = "query"> Request </param>
        /// <returns> </returns>
        public async Task <SearchVm <DataSourceVm> > GetAllDataSources(SearchQueryM query)
        {
            var wildcard          = query.Wildcard;
            var statUnitType      = query.StatUnitType;
            var priority          = (DataSourcePriority)query.Priority;
            var allowedOperations = (DataSourceAllowedOperation)query.AllowedOperations;

            var sortBy = string.IsNullOrEmpty(query.SortBy)
                ? "Id"
                : query.SortBy;

            var orderRule = query.OrderByValue == OrderRule.Asc
                ? "ASC"
                : "DESC";

            var filtered = _context.DataSources
                           .AsNoTracking()
                           .Where(ds => string.IsNullOrEmpty(wildcard) || ds.Name.ToLower().Contains(wildcard.ToLower()))
                           .Where(ds => statUnitType == 0 || ds.StatUnitType == (StatUnitTypes)statUnitType)
                           .Where(ds => priority == 0 || ds.Priority == priority)
                           .Where(ds => allowedOperations == 0 || ds.AllowedOperations == allowedOperations)
                           .OrderBy($"{sortBy} {orderRule}");


            var total = await filtered.CountAsync();

            if (query.GetAll)
            {
                var res = await filtered.ToListAsync();

                return(SearchVm <DataSourceVm> .Create(res.Select(DataSourceVm.Create), total));
            }

            var result = await filtered
                         .Skip(Pagination.CalculateSkip(query.PageSize, query.Page, total))
                         .Take(query.PageSize)
                         .ToListAsync();

            return(SearchVm <DataSourceVm> .Create(result.Select(DataSourceVm.Create), total));
        }
Exemplo n.º 6
0
        private async Task GetQueuesByStatus()
        {
            using (var ctx = CreateDbContext())
            {
                var query = new SearchQueryM {
                    Status = DataSourceQueueStatuses.DataLoadCompletedPartially
                };

                var dataSource = new DataSource {
                    Name = "TestDS"
                };
                ctx.DataSources.Add(dataSource);

                var user = new User {
                    Name = "TestUser"
                };
                ctx.Users.Add(user);

                ctx.DataSourceQueues.AddRange(
                    new DataSourceQueue
                {
                    Status     = DataSourceQueueStatuses.DataLoadCompletedPartially,
                    DataSource = dataSource,
                    User       = user
                },
                    new DataSourceQueue
                {
                    Status     = DataSourceQueueStatuses.InQueue,
                    DataSource = dataSource,
                    User       = user
                });
                await ctx.SaveChangesAsync();

                var result = await CreateEmptyConfiguredDataSourceQueueService(ctx).GetAllDataSourceQueues(query);

                Assert.Single(result.Result);
                Assert.Equal((int)DataSourceQueueStatuses.DataLoadCompletedPartially, result.Result.First()?.Status);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Connection search method
        /// </summary>
        /// <param name = "search"> Link search model </param>
        /// <param name = "userId"> user ID </param>
        /// <returns> </returns>
        public async Task <List <UnitNodeVm> > Search(LinkSearchM search, string userId)
        {
            var searchModel = new SearchQueryM()
            {
                Name = search.Wildcard,
                Type = search.Type != null
                    ? new List <StatUnitTypes> {
                    (StatUnitTypes)search.Type
                }
                    : new List <StatUnitTypes>(),
                RegId                      = search.Id,
                RegionId                   = search.RegionCode,
                LastChangeFrom             = search.LastChangeFrom,
                LastChangeTo               = search.LastChangeTo,
                DataSourceClassificationId = search.DataSourceClassificationId,
                PageSize                   = 20
            };
            var searchResponse = await _elasticService.Search(searchModel, userId, false);

            var units   = searchResponse.Result.ToList();
            var list    = new List <IStatisticalUnit>();
            var listIds = units.Select(x => x.RegId).ToList();
            var type    = search.Type;

            if (type == null || type == StatUnitTypes.EnterpriseGroup)
            {
                var entGroup = _commonSvc.GetUnitsList <EnterpriseGroup>(false)
                               .Where(x => listIds.Contains(x.RegId))
                               .Include(x => x.EnterpriseUnits)
                               .ThenInclude(x => x.LegalUnits)
                               .ThenInclude(x => x.LocalUnits);
                list.AddRange(entGroup);
                list.AddRange(entGroup.SelectMany(x => x.EnterpriseUnits.Where(y => y.IsDeleted == false)));
                list.AddRange(entGroup.SelectMany(x => x.EnterpriseUnits.Where(y => y.IsDeleted == false).SelectMany(y => y.LegalUnits.Where(z => z.IsDeleted == false))));
                list.AddRange(entGroup.SelectMany(x => x.EnterpriseUnits.Where(y => y.IsDeleted == false).SelectMany(y => y.LegalUnits.Where(z => z.IsDeleted == false).SelectMany(z => z.LocalUnits.Where(l => l.IsDeleted == false)))));
            }

            if (type == null || type == StatUnitTypes.EnterpriseUnit)
            {
                var entUnit = _commonSvc.GetUnitsList <EnterpriseUnit>(false)
                              .Where(x => listIds.Contains(x.RegId))
                              .Include(x => x.LegalUnits)
                              .ThenInclude(x => x.LocalUnits)
                              .Include(x => x.EnterpriseGroup);

                list.AddRange(entUnit.Where(x => x.EnterpriseGroup.IsDeleted == false).Select(x => x.EnterpriseGroup));
                list.AddRange(entUnit);
                list.AddRange(entUnit.SelectMany(x => x.LegalUnits.Where(y => y.IsDeleted == false)));
                list.AddRange(entUnit.SelectMany(x => x.LegalUnits.Where(y => y.IsDeleted == false).SelectMany(y => y.LocalUnits.Where(z => z.IsDeleted == false))));
            }

            if (type == null || type == StatUnitTypes.LegalUnit)
            {
                var legalUnit = _commonSvc.GetUnitsList <LegalUnit>(false)
                                .Where(x => listIds.Contains(x.RegId))
                                .Include(x => x.EnterpriseUnit)
                                .ThenInclude(x => x.EnterpriseGroup)
                                .Include(x => x.LocalUnits);

                list.AddRange(legalUnit.Where(x => x.EnterpriseUnit.IsDeleted == false).Select(x => x.EnterpriseUnit).Where(x => x.EnterpriseGroup.IsDeleted == false).Select(x => x.EnterpriseGroup));
                list.AddRange(legalUnit.Where(x => x.EnterpriseUnit.IsDeleted == false).Select(x => x.EnterpriseUnit));
                list.AddRange(legalUnit);
                list.AddRange(legalUnit.SelectMany(x => x.LocalUnits.Where(y => y.IsDeleted == false)));
            }

            if (type == null || type == StatUnitTypes.LocalUnit)
            {
                var localUnit = _commonSvc.GetUnitsList <LocalUnit>(false)
                                .Where(x => listIds.Contains(x.RegId))
                                .Include(x => x.LegalUnit)
                                .ThenInclude(x => x.EnterpriseUnit)
                                .ThenInclude(x => x.EnterpriseGroup);

                list.AddRange(localUnit.Where(x => x.LegalUnit.IsDeleted == false).Select(x => x.LegalUnit).Where(x => x.EnterpriseUnit.IsDeleted == false).Select(x => x.EnterpriseUnit).Where(x => x.EnterpriseGroup.IsDeleted == false).Select(x => x.EnterpriseGroup));
                list.AddRange(localUnit.Where(x => x.LegalUnit.IsDeleted == false).Select(x => x.LegalUnit).Where(x => x.EnterpriseUnit.IsDeleted == false).Select(x => x.EnterpriseUnit));
                list.AddRange(localUnit.Where(x => x.LegalUnit.IsDeleted == false).Select(x => x.LegalUnit));
                list.AddRange(localUnit);
            }

            return(ToNodeVm(list, listIds));
        }
Exemplo n.º 8
0
 public async Task <IActionResult> GetDeleted(SearchQueryM data) =>
 Ok(await _searchService.Search(data, User.GetUserId(), true));
Exemplo n.º 9
0
 public async Task <IActionResult> GetAllPaged([FromQuery] SearchQueryM data) =>
 Ok(await _svc.GetAllDataSources(data));
Exemplo n.º 10
0
        /// <summary>
        /// Stat search method. units by code
        /// </summary>
        /// <param name = "type"> Type of static unit </param>
        /// <param name = "code"> Code </param>
        /// <param name = "isDeleted"> Delete flag </param>
        /// <param name = "limit"> Display limitation </param>
        /// <param name = "userId"> User Id </param>
        /// <param name = "regId"> Registration Id </param>
        /// <param name = "page"> Current page </param>
        /// <returns> </returns>
        public async Task <List <UnitLookupVm> > Search(StatUnitTypes type, string code, string userId, int regId, bool isDeleted, int limit = 5, int page = 1)
        {
            if (isDeleted)
            {
                var list = new List <UnitLookupVm>();

                var root = new UnitSubmitM()
                {
                    Id   = regId,
                    Type = type
                };
                switch (type)
                {
                case StatUnitTypes.EnterpriseGroup:
                    list.AddRange(Common.ToUnitLookupVm(
                                      await _commonSvc.GetUnitsList <EnterpriseUnit>(false)
                                      .Where(v => v.EntGroupId == regId)
                                      .Select(Common.UnitMapping)
                                      .ToListAsync()
                                      ));
                    break;

                case StatUnitTypes.EnterpriseUnit:
                    list.AddRange(Common.ToUnitLookupVm(
                                      await _commonSvc.GetUnitsList <EnterpriseUnit>(false)
                                      .Where(v => v.RegId == regId)
                                      .Include(v => v.EnterpriseGroup)
                                      .Select(v => v.EnterpriseGroup)
                                      .Select(Common.UnitMapping)
                                      .ToListAsync()
                                      ));
                    list.AddRange(Common.ToUnitLookupVm(
                                      await _commonSvc.GetUnitsList <LegalUnit>(false)
                                      .Where(v => v.EnterpriseUnitRegId == regId)
                                      .Select(Common.UnitMapping)
                                      .ToListAsync()
                                      ));
                    break;

                case StatUnitTypes.LegalUnit:
                    list.AddRange(Common.ToUnitLookupVm(
                                      await _commonSvc.GetUnitsList <LegalUnit>(false)
                                      .Where(v => v.RegId == regId)
                                      .Include(v => v.EnterpriseUnit)
                                      .Select(v => v.EnterpriseUnit)
                                      .Select(Common.UnitMapping)
                                      .ToListAsync()
                                      ));
                    list.AddRange(Common.ToUnitLookupVm(
                                      await _commonSvc.GetUnitsList <LocalUnit>(false)
                                      .Where(v => v.LegalUnitId == regId)
                                      .Select(Common.UnitMapping)
                                      .ToListAsync()
                                      ));
                    break;

                case StatUnitTypes.LocalUnit:
                    var linkedList = await _service.LinksList(root);

                    if (linkedList.Count > 0)
                    {
                        list.Add(new UnitLookupVm {
                            Id = linkedList[0].Source1.Id, Type = linkedList[0].Source1.Type, Code = linkedList[0].Source1.Code, Name = linkedList[0].Source1.Name
                        });
                    }
                    break;
                }

                return(list);
            }

            var statUnitTypes = new List <StatUnitTypes>();

            switch (type)
            {
            case StatUnitTypes.LocalUnit:
                statUnitTypes.Add(StatUnitTypes.LegalUnit);
                break;

            case StatUnitTypes.LegalUnit:
                statUnitTypes.Add(StatUnitTypes.LocalUnit);
                statUnitTypes.Add(StatUnitTypes.EnterpriseUnit);
                break;

            case StatUnitTypes.EnterpriseUnit:
                statUnitTypes.Add(StatUnitTypes.LegalUnit);
                statUnitTypes.Add(StatUnitTypes.EnterpriseGroup);
                break;

            case StatUnitTypes.EnterpriseGroup:
                statUnitTypes.Add(StatUnitTypes.EnterpriseUnit);
                break;
            }

            var filter = new SearchQueryM
            {
                Type     = statUnitTypes,
                StatId   = code,
                Page     = page,
                PageSize = limit
            };

            var searchResponse = await _elasticService.Search(filter, userId, isDeleted);

            return(searchResponse.Result.Select(u => new UnitLookupVm {
                Id = u.RegId, Code = u.StatId, Name = u.Name, Type = u.UnitType
            }).ToList());
        }
Exemplo n.º 11
0
        public async Task <SearchVm <ElasticStatUnit> > Search(SearchQueryM filter, string userId, bool isDeleted)
        {
            await Synchronize();

            var mustQueries =
                new List <Func <QueryContainerDescriptor <ElasticStatUnit>, QueryContainer> >
            {
                m => m.Term(p => p.Field(f => f.IsDeleted).Value(isDeleted))
            };

            var separators = new[] { ' ', '\t', '\r', '\n', ',', '.', '-' };

            if (!string.IsNullOrWhiteSpace(filter.Name))
            {
                var nameFilterParts = filter.Name.ToLower().Split(separators, StringSplitOptions.RemoveEmptyEntries);
                foreach (var nameFilter in nameFilterParts)
                {
                    mustQueries.Add(m => m.Prefix(p => p.Field(f => f.Name).Value(nameFilter)));
                }
            }

            if (filter.Type.Any())
            {
                mustQueries.Add(m => m.Terms(p => p.Field(f => f.UnitType).Terms(filter.Type)));
            }

            if (!string.IsNullOrWhiteSpace(filter.StatId))
            {
                mustQueries.Add(m => m.Terms(p => p.Field(f => f.StatId).Terms(filter.StatId)));
            }

            if (!string.IsNullOrWhiteSpace(filter.ExternalId))
            {
                mustQueries.Add(m => m.Terms(p => p.Field(f => f.ExternalId).Terms(filter.ExternalId)));
            }

            if (!string.IsNullOrWhiteSpace(filter.TaxRegId))
            {
                mustQueries.Add(m => m.Terms(p => p.Field(f => f.TaxRegId).Terms(filter.TaxRegId)));
            }

            if (!string.IsNullOrWhiteSpace(filter.Address))
            {
                string[] addressFilters = filter.Address.ToLower().Split(separators, StringSplitOptions.RemoveEmptyEntries);
                foreach (var addressFilter in addressFilters)
                {
                    mustQueries.Add(m => m
                                    .Bool(b => b
                                          .Should(s => s.Prefix(t => t.Field(f => f.AddressPart1).Value(addressFilter)) ||
                                                  s.Prefix(t => t.Field(f => f.AddressPart2).Value(addressFilter)) ||
                                                  s.Prefix(t => t.Field(f => f.AddressPart3).Value(addressFilter)))
                                          )
                                    );
                }
            }

            var turnoverQueries = new List <Func <QueryContainerDescriptor <ElasticStatUnit>, QueryContainer> >();

            if (filter.TurnoverFrom.HasValue)
            {
                double turnoverFrom = (double)filter.TurnoverFrom.Value;
                turnoverQueries.Add(m => m.Range(p => p.Field(f => f.Turnover).GreaterThanOrEquals(turnoverFrom)));
            }
            if (filter.TurnoverTo.HasValue)
            {
                double turnoverTo = (double)filter.TurnoverTo.Value;
                turnoverQueries.Add(m => m.Range(p => p.Field(f => f.Turnover).LessThanOrEquals(turnoverTo)));
            }

            var employeeQueries = new List <Func <QueryContainerDescriptor <ElasticStatUnit>, QueryContainer> >();

            if (filter.EmployeesNumberFrom.HasValue)
            {
                int employeesNumberFrom = (int)filter.EmployeesNumberFrom.Value;
                employeeQueries.Add(m => m.Range(p => p.Field(f => f.Employees).GreaterThanOrEquals(employeesNumberFrom)));
            }
            if (filter.EmployeesNumberTo.HasValue)
            {
                int employeesNumberTo = (int)filter.EmployeesNumberTo.Value;
                employeeQueries.Add(m => m.Range(p => p.Field(f => f.Employees).LessThanOrEquals(employeesNumberTo)));
            }
            if (filter.Comparison == ComparisonEnum.And || turnoverQueries.Count == 0 || employeeQueries.Count == 0)
            {
                mustQueries.AddRange(turnoverQueries);
                mustQueries.AddRange(employeeQueries);
            }
            else
            {
                mustQueries.Add(m => m.Bool(b => b.Should(s => s.Bool(b1 => b1.Must(turnoverQueries)), s => s.Bool(b2 => b2.Must(employeeQueries)))));
            }

            if (filter.LastChangeFrom.HasValue)
            {
                DateTime lastChangeFrom = filter.LastChangeFrom.Value.ToUniversalTime();
                mustQueries.Add(m => m.DateRange(p => p.Field(f => f.StartPeriod).GreaterThanOrEquals(lastChangeFrom)));
            }

            if (filter.LastChangeTo.HasValue)
            {
                DateTime lastChangeTo = filter.LastChangeTo.Value.ToUniversalTime().AddHours(23).AddMinutes(59).AddSeconds(59);
                mustQueries.Add(m => m.DateRange(p => p.Field(f => f.StartPeriod).LessThanOrEquals(lastChangeTo)));
            }

            if (filter.LastChangeFrom.HasValue || filter.LastChangeTo.HasValue)
            {
                mustQueries.Add(m => m.Bool(b => b.MustNot(mn => mn.Term(p => p.Field(f => f.ChangeReason).Value(ChangeReasons.Create)))));
            }

            if (filter.DataSourceClassificationId.HasValue)
            {
                int dataSourceClassificationId = filter.DataSourceClassificationId.Value;
                mustQueries.Add(m => m.Term(p => p.Field(f => f.DataSourceClassificationId).Value(dataSourceClassificationId)));
            }

            if (!filter.IncludeLiquidated.HasValue || !filter.IncludeLiquidated.Value)
            {
                mustQueries.Add(m => !m.Exists(e => e.Field(f => f.LiqDate)));
            }

            if (filter.RegMainActivityId.HasValue)
            {
                var regMainActivityIds = new[] { filter.RegMainActivityId.Value };
                mustQueries.Add(m => m.Terms(p => p.Field(f => f.ActivityCategoryIds).Terms(regMainActivityIds)));
            }

            if (filter.RegId.HasValue)
            {
                int id = filter.RegId.Value;
                mustQueries.Add(m => m.Term(p => p.Field(f => f.RegId).Value(id)));
            }
            if (filter.SectorCodeId.HasValue)
            {
                int sectorCodeId = filter.SectorCodeId.Value;
                mustQueries.Add(m => m.Term(p => p.Field(f => f.SectorCodeId).Value(sectorCodeId)));
            }

            if (filter.LegalFormId.HasValue)
            {
                int legalFormId = filter.LegalFormId.Value;
                mustQueries.Add(m => m.Term(p => p.Field(f => f.LegalFormId).Value(legalFormId)));
            }

            if (filter.RegionId.HasValue)
            {
                int regionId = filter.RegionId.Value;
                mustQueries.Add(m => m.Term(p => p.Field(f => f.RegionId).Value(regionId)));
            }

            Func <SearchDescriptor <ElasticStatUnit>, ISearchRequest> searchFunc;

            if (filter.SortBy.HasValue)
            {
                searchFunc = s =>
                             s.Index(StatUnitSearchIndexName).From(0).Take(10000).Query(q => q.Bool(b => b.Must(mustQueries))).TerminateAfter(2000);
            }
            else
            {
                searchFunc = s =>
                             s.Index(StatUnitSearchIndexName).From((filter.Page - 1) * filter.PageSize).Take(filter.PageSize)
                             .Query(q => q.Bool(b => b.Must(mustQueries))).TerminateAfter(2000);
            }

            var searchResponse = await _elasticClient.SearchAsync(searchFunc);

            if (!searchResponse.IsValid)
            {
                return(SearchVm <ElasticStatUnit> .Create(new List <ElasticStatUnit>(), 0));
            }
            //throw new Exception(searchResponse.DebugInformation);

            List <ElasticStatUnit> units = searchResponse.Documents.ToList();

            if (filter.SortBy.HasValue)
            {
                IOrderedEnumerable <ElasticStatUnit> sortQuery;
                switch (filter.SortBy.Value)
                {
                case SortFields.Employees:
                    sortQuery = filter.SortRule == OrderRule.Asc ? units.OrderBy(u => u.Employees) : units.OrderByDescending(u => u.Employees);
                    break;

                case SortFields.StatId:
                    sortQuery = filter.SortRule == OrderRule.Asc ? units.OrderBy(u => u.StatId) : units.OrderByDescending(u => u.StatId);
                    break;

                case SortFields.Turnover:
                    sortQuery = filter.SortRule == OrderRule.Asc ? units.OrderBy(u => u.Turnover) : units.OrderByDescending(u => u.Turnover);
                    break;

                default:
                    sortQuery = filter.SortRule == OrderRule.Asc ? units.OrderBy(u => u.Name) : units.OrderByDescending(u => u.Name);
                    break;
                }
                units = sortQuery.Skip((filter.Page - 1) * filter.PageSize).Take(filter.PageSize).ToList();
            }
            return(SearchVm <ElasticStatUnit> .Create(units, searchResponse.Total));
        }
Exemplo n.º 12
0
 public async Task <IActionResult> Search([FromQuery] SearchQueryM query) =>
 Ok(await _searchService.Search(query, User.GetUserId()));
Exemplo n.º 13
0
 public async Task <IActionResult> GetAll([FromQuery] SearchQueryM model) =>
 Ok(await _sampleFramesService.GetAll(model, User.GetUserId()));