Esempio n. 1
0
        /// <inheritdoc/>
        public Task <PageResult <TData> > GetAsync <TData>(string projectionName, Expression <Func <TData, bool> > filter, OrderByDefinition <TData> orderBy, int page = 1, int pageSize = 25)
            where TData : class
        {
            var mongoFilter = Builders <TData> .Filter.Where(filter).Render(BsonSerializer.SerializerRegistry.GetSerializer <TData>(), BsonSerializer.SerializerRegistry);

            var parsedFilter = mongoFilter.ToString();

            return(this.GetAsync <TData>(projectionName, parsedFilter, orderBy.GenerateBsonDocument(), page, pageSize));
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public Task <PageResult <User> > SearchAsync(string name = null, string roleId = null, OrderByDefinition <User> orderBy = null, bool activeOnly = true, int page = 1, int pageSize = 25)
        {
            var parsedOrderBy = string.Empty;

            if (orderBy != null)
            {
                parsedOrderBy = orderBy.GenerateBsonDocument();
            }

            return(this.SearchAsync(name, roleId, parsedOrderBy, activeOnly, page, pageSize));
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public Task <PageResult <TModel> > SearchAsync <TModel>(Expression <Func <TModel, bool> > filter, OrderByDefinition <TModel> orderBy = null, int page = 1, int pageSize = 25)
            where TModel : MeshData
        {
            var mongoFilter = Builders <TModel> .Filter.Where(filter).Render(BsonSerializer.SerializerRegistry.GetSerializer <TModel>(), BsonSerializer.SerializerRegistry);

            var encodedUrl = WebUtility.UrlEncode(mongoFilter.ToString());

            var encodedOrderBy = string.Empty;

            if (orderBy != null)
            {
                encodedOrderBy = WebUtility.UrlEncode(orderBy.GenerateBsonDocument());
            }

            return(this.requestService.GetRequest <PageResult <TModel> >($"meshes/{this.GetMeshName<TModel>()}?filter={encodedUrl}&orderby={encodedOrderBy}&page={page}&pageSize={pageSize}"));
        }