Exemplo n.º 1
0
        public async Task <PagedResult <SiteMetricsModel> > SearchAsync(RequestProfileSearchCommand command)
        {
            using (var context = ContextProvider())
            {
                var query = from p in context.RequestProfile where p.Ipaddress != "::1" select p;
                query = query.OrderByDescending(x => x.LastAccessTime);
                var count = query.Count();

                var result = await query.Skip(command.PageNumber *command.PageSize).Take(command.PageSize).ToListAsync();

                var data = Mapper.MapCollection <SiteMetricsModel, RequestProfile>(await query.ToListAsync());

                return(new PagedResult <SiteMetricsModel>
                {
                    Count = count,
                    Result = data.ToList()
                });
            }
        }
Exemplo n.º 2
0
 public async Task <PagedResult <SiteMetricsModel> > Search([FromBody] RequestProfileSearchCommand command)
 {
     return(await Service.SearchAsync(command));
 }