Ejemplo n.º 1
0
 public PageResult GetByPage(int pageSize, int pageNumber, string orderBy, string direction)
 {
     using (var context = CreateContext(ConnectionString))
     {
         var repo  = new Repository <TEntity>(context);
         var query = repo.GetAllQuery();
         return(PagingHelper.GetPageResult(context, query, pageSize, pageNumber, orderBy, direction));
     }
 }
Ejemplo n.º 2
0
 public PageResult GetByPropertyByPage(string propertyName, Guid guid, int pageSize, int pageNumber, string orderBy, string direction)
 {
     using (var context = CreateContext(ConnectionString))
     {
         var repo   = new Repository <TEntity>(context);
         var lambda = Utilities.BuildEqualsExpression <TEntity>(propertyName, guid);
         var query  = repo.GetAllQueryBy(lambda);
         return(PagingHelper.GetPageResult(context, query, pageSize, pageNumber, orderBy, direction));
     }
 }
 public PageResult GetAllDevicesForDeviceTypeByPage(Guid deviceType, int pageSize, int currentPage, string sortOrder, string direction)
 {
     using (var context = new SmartHomeAutomationContext())
     {
         Query = context.DeviceTypes
                 .Include(d => d.Devices)
                 .Where(d => d.Devices.Any(dt => dt.DeviceType.DeviceTypeId == deviceType))
                 .AsQueryable();
         return(PagingHelper.GetPageResult(context, Query, pageSize, currentPage, sortOrder, direction));
     }
 }