Пример #1
0
        public Task <BaseFindResponse <Widget> > FindAsync(WidgetFindRequest request)
        {
            return(Task.Run(() =>
            {
                var query = context.WidgetsAsQueryable;
                if (!string.IsNullOrEmpty(request.Title))
                {
                    query = query.Where(a => a.Title.ToLowerInvariant().Contains(request.Title.ToLowerInvariant()));
                }

                var response = query.OrderBy(a => a.Title)
                               .Skip(request.Skip)
                               .Take(request.PageSize)
                               .ToList();

                return new BaseFindResponse <Widget>
                {
                    Results = response,
                    TotalRecords = query.Count()
                };
            }));
        }
Пример #2
0
 public Task <BaseFindResponse <Widget> > FindAsync(WidgetFindRequest request)
 {
     return(_widgetRepository.FindAsync(request));
 }