public Task <List <Floor> > List(FloorSearchParams searchParams)
        {
            var taskResult = Task.Run(() =>
            {
                using (var context = new DbContext())
                {
                    var qry = context
                              .Floors
                              .Include(f => f.Facility)
                              .Include(f => f.FlatParkings)
                              //.Include(f => f.FlatParkings.Select(p => p.ParkingType))
                              .Include(f => f.Flats)
                              .AsQueryable();

                    if (searchParams.FacilityId.HasValue)
                    {
                        qry = qry
                              .Where(f => f.FacilityId == searchParams.FacilityId.Value);
                    }

                    return(qry
                           .ToList());
                }
            });

            return(taskResult);
        }
        public Task <List <Floor> > SocietyWiseList(FloorSearchParams searchParams)
        {
            var taskResult = Task.Run(() =>
            {
                using (var context = new DbContext())
                {
                    var ctx = (from msf in context.MapsSocietiesToFacilities
                               join fl in context.Facilities on msf.FacilityId equals fl.Id
                               join fr in context.Floors on fl.Id equals fr.FacilityId
                               where msf.SocietyId == searchParams.SocietyId.Value
                               select fr)
                              .Include(f => f.Facility)
                              .Include(f => f.FlatParkings)
                              .Include(f => f.Flats)
                              .AsQueryable();

                    return(ctx
                           .ToList());
                }
            });

            return(taskResult);
        }
Esempio n. 3
0
 public Task <List <Floor> > SocietyWiseList(FloorSearchParams searchParams)
 {
     return(_floorRepository.SocietyWiseList(searchParams));
 }
Esempio n. 4
0
 public Task <List <Floor> > List(FloorSearchParams searchParams)
 {
     return(_floorRepository.List(searchParams));
 }