public PagedList <User> GetAllUsers(User user, string orderBy, string orderAs, int page) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { string userName = user == null ? "" : user.UserName + ""; PagedList <User> listUser = context.FindAllByPage <User>(obj => obj.UserName.Contains(userName), orderBy, orderAs, page); return(listUser); } } catch { throw; } }
public PagedList <City> GetAllCities(City city, string orderBy, string orderAs, int page) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { string name = city == null ? "" : city.Name + ""; PagedList <City> listCity = context.FindAllByPage <City>(obj => obj.Name.Contains(name), orderBy, orderAs, page); return(listCity); } } catch { throw; } }
public PagedList <District> GetAllDistricts(District district, string orderBy, string orderAs, int page) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { string name = district == null ? "" : district.Name + ""; PagedList <District> listDistrict = context.FindAllByPage <District>(obj => obj.Name.Contains(name), orderBy, orderAs, page); return(listDistrict); } } catch { throw; } }
//IDbContextBase context = DbContextFactory.GetDbContext(); public PagedList <Property> GetAllProperties(Property property, string orderBy, string orderAs, int page) { try { using (IDbContextBase context = DbContextFactory.GetDbContext()) { string name = property == null ? "" : property.Name + ""; Expression <Func <Property, bool> > conditions = obj => obj.Name.Contains(name); PagedList <Property> listProperty = context.FindAllByPage <Property>(conditions, orderBy, orderAs, page); return(listProperty); } } catch { throw; } }