Exemple #1
0
            public async Task <IList <PropertyDto> > Handle(GetPropertiesQuery request, CancellationToken cancellationToken)
            {
                var vm = await _context.Property
                         .ProjectTo <PropertyDto>(_mapper.ConfigurationProvider)
                         .ToListAsync(cancellationToken);

                return(vm);
            }
Exemple #2
0
            public async Task <IList <ListPropertyDto> > Handle(GetPropertiesQuery request, CancellationToken cancellationToken)
            {
                var properties = await _repo.GetAllAsync();

                var dtos = properties.Select(
                    x => new ListPropertyDto(x.Id, x.Surface)
                    ).ToList();

                return(dtos);
            }
Exemple #3
0
        public async Task <IEnumerable <PropertyResponse> > GetAsync(int agencyId, GetPropertiesQuery query)
        {
            var propertiesQuery = _dbContext.Properties.Include(item => item.Attachments)
                                  .Where(item => item.AgencyId == agencyId)
                                  .AsQueryable();

            propertiesQuery = BuildFilters(propertiesQuery, query.Filters);
            propertiesQuery = BuildOrderings(propertiesQuery, query.Orderings);

            var properties = await propertiesQuery.AsNoTracking().ToListAsync();

            return(Mapper.Map <IEnumerable <Property>, IEnumerable <PropertyResponse> >(properties));
        }