Esempio n. 1
0
 public async Task <List <PlaceDto> > Handle(GetPlacesQuery request, CancellationToken cancellationToken)
 => await(from p in _context.Places
              where p.IsConfirmed
          join c in _context.Categories on p.CategoryId equals c.PlaceCategoryId
          join v in _context.Visits.Where(x => x.VisitedById == request.UserId) on p.PlaceId equals v.PlaceId into visit
          from subv in visit.DefaultIfEmpty()
          select new PlaceDto(p.PlaceId, p.Latitude, p.Attitude, p.Name, p.Description, p.Address, c.Name,
                              subv != null, p.Zoom))
 .ToListAsync();
Esempio n. 2
0
        public async Task <GetPlacesResponse> Handle(GetPlacesRequest request, CancellationToken cancellationToken)
        {
            var query = new GetPlacesQuery()
            {
            };
            var places = await this.queryExecutor.Execute(query);

            var mappedPlaces = this.mapper.Map <List <Domain.Models.Place> >(places);

            var response = new GetPlacesResponse()
            {
                Data = mappedPlaces
            };

            return(response);
        }
 public async Task <IEnumerable <PlaceOutputModel> > Handle(
     GetPlacesQuery request,
     CancellationToken cancellationToken)
 => await placeQueryRepository.Get();
 public List <PublishPlace> Handle(GetPlacesQuery query)
 {
     return(_publishPlaceQueryRepository.GetAll());
 }