Example #1
0
        public async Task <DataResult <User> > GetAllData()
        {
            QueryDto2 query = new QueryDto2()
            {
                Skip  = 0,
                Top   = int.MaxValue,
                Count = false,
            };

            return(await GetODataData(query));
        }
Example #2
0
        public async Task <DataResult <User> > GetODataData([FromBody] QueryDto2 query)
        {
            var source = _context.Users.Where(x => 1 == 1);

            if (query.Min != null)
            {
                source = source.Where(x => x.DouV >= query.Min.Value);
            }
            if (query.Max != null)
            {
                source = source.Where(x => x.DouV <= query.Max.Value);
            }
            if (query.OrderingsIsNullOrEmpty())
            {
                source = source.OrderBy(x => x.Id);
            }
            return(await source.ToODataResultAsync(query));
        }