Ejemplo n.º 1
0
        public async Task <ObjectResult> GetEvents([FromBody] GetEventsQuery query)
        {
            var handler = new GetEventsQueryHandler(_context);
            var events  = await handler.HandleAsync(query);

            return(Ok(events));
        }
Ejemplo n.º 2
0
        private async Task UpdateData()
        {
            IsLoading = true;
            var query = new GetEventsQuery
            {
                From       = FromDate,
                Source     = DeviceId,
                PageSize   = PageSize,
                PageNumber = PageNumber
            };

            if (Filters.Any(x => x.Property == nameof(EventVm.EventName)))
            {
                query.EventName = Filters.FirstOrDefault(x => x.Property == nameof(EventVm.EventName))
                                  ?.FilterValue
                                  .ToString();
            }

            if (Filters.Any(x => x.Property == nameof(EventVm.EventType)))
            {
                query.EventType = Enum.Parse <EventType>(Filters
                                                         .FirstOrDefault(x => x.Property == nameof(EventVm.EventType))
                                                         ?.FilterValue
                                                         .ToString() ?? string.Empty, true);
            }

            var result = await EventLogService.GetEvents(query, false);

            Data      = result.Result;
            Count     = result.ResultTotalCount;
            IsLoading = false;
        }
Ejemplo n.º 3
0
 public async Task <IEnumerable <EventDto> > Handle(GetEventsQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Events
            .AsNoTracking()
            .Where(e => !e.DeletedDate.HasValue)
            .ProjectTo <EventDto>(_mapper.ConfigurationProvider)
            .ToListAsync(cancellationToken));
 }
Ejemplo n.º 4
0
        public override async Task <IEnumerable <TicketsPool> > Handle(GetEventsQuery request, CancellationToken cancellationToken)
        {
            var repo = new TableRepository <TicketsPool>(); //use ioc

            var allEvents = await repo.GetAll();

            var events = allEvents.OrderBy(ev => ev.EventName);

            return(events);
        }
Ejemplo n.º 5
0
        protected override IEnumerable <EventDto> Handle(GetEventsQuery request)
        {
            var events = _dbContext.Events
                         .Include(e => e.Category)
                         .Include(e => e.Organiser)
                         .Where(e => e.EndDate > DateTime.UtcNow)
                         .OrderBy(e => e.StartDate);

            return(Mapper.Map <IEnumerable <EventDto> >(events));
        }
Ejemplo n.º 6
0
        public IActionResult Get([FromQuery] GetEventsQuery query)
        {
            var events = _mediator.Send(query);

            if (events.Result == null)
            {
                return(BadRequest("Error"));
            }
            return(Ok(events));
        }
        public async Task <IActionResult> GetEvents()
        {
            using (MiniProfiler.Current.Step("Get Events"))
            {
                GetEventsQuery query = new GetEventsQuery();
                List <GetEventsQueryViewModel> model = await _mediator.Send(query);

                if (model != null)
                {
                    return(Ok(model));
                }
                throw new NotFoundCustomException("No data found", $"Please check your parameters : ");
            }
        }
        public async Task <IEnumerable <GetEventsQueryResult> > GetEvents(GetEventsQuery getEventsQuery)
        {
            var queryRequest = new QueryRequest()
                               .Statement(@"SELECT META().id, subject, date, endDate, capacity, status, attendeeCount FROM events 
                                  WHERE groupId = $groupId")
                               .AddNamedParameter("$groupId", getEventsQuery.GroupId.ToString());

            var queryResult = await _eventsBucket.QueryAsync <GetEventsQueryResult>(queryRequest);

            if (!queryResult.Success)
            {
                throw queryResult.Exception;
            }

            return(queryResult.Rows);
        }
        public async Task <PaginationResult <EventVm> > Handle(GetEventsQuery request, CancellationToken cancellationToken)
        {
            var result = await _eventStoreClient.FindEventsByCriteriaAsync(request, cancellationToken);

            return(new PaginationResult <EventVm>
            {
                ResultTotalCount = result.ResultTotalCount,
                PageSize = result.PageSize,
                PageNumber = result.PageNumber,
                Result = result.Result.Select(x => new EventVm
                {
                    Source = x.Source,
                    EventName = x.EventName,
                    EventData = x.EventData,
                    EventType = x.EventType,
                    Timestamp = x.Timestamp,
                    Id = x.Id.ToString()
                }).ToList()
            });
        }
        public async Task <List <GetEventsQueryViewModel> > Handle(GetEventsQuery request, CancellationToken cancellationToken)
        {
            List <GetEventsQueryViewModel> viewModel = new List <GetEventsQueryViewModel>();

            try
            {
                var response = await _eventbriteService.GetEvents();

                if (response.Events.Any())
                {
                    foreach (var res in response.Events)
                    {
                        viewModel.Add(_mapper.Map <GetEventsQueryViewModel>(res));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogInformation(ex.Message);
            }

            return(viewModel);
        }
Ejemplo n.º 11
0
 public Task <PaginationResult <EventVm> > GetEvents(GetEventsQuery query, bool withCache = true)
 {
     return(_apiClient.Get <GetEventsQuery, PaginationResult <EventVm> >("EventLog", query, withCache ? null : _apiClient.NoCacheHeader));
 }
Ejemplo n.º 12
0
 public async Task <IActionResult> GetEvents([FromQuery] GetEventsQuery query)
 {
     return(Ok((await _mediator.Send(query))));
 }
Ejemplo n.º 13
0
 public async Task <IList <EventDto> > Handle(GetEventsQuery request, CancellationToken cancellationToken)
 {
     return(await _eventAppService.GetEventsAsync(request.IncludeIsDeleted));
 }
Ejemplo n.º 14
0
 public async Task <Result <NextPagedResult <Event> > > Events([FromBody] GetEventsQuery request)
 {
     return(await _mediator.Send(request));
 }