예제 #1
0
 public long GetApartmentsCount(GetApartmentsParams param)
 {
     var query = GetApartmentQuery(param);
     return query.Count();
 }
예제 #2
0
 private IQueryable<Apartment> GetApartmentQuery(GetApartmentsParams param)
 {
     return context.Apartments.Where(m => m.Published == true)
         .Include(m => m.Profile)
         .Include(m => m.ApartmentOptions)
         .Include(m => m.Type)
         .Include(m => m.DefaultPhoto.Links)
         .Include(m => m.ApartmentPhotos.Select(k => k.Links))
         .OrderByDescending(m => m.UpdateDate)
         .AsQueryable();
 }
예제 #3
0
 public List<Apartment> GetApartments(GetApartmentsParams param)
 {
     var query = GetApartmentQuery(param);
     if (param.Take != 0)
     {
         query = query.Skip(param.Skip).Take(param.Take);
     }
     return query
         .ToList();
 }