public async Task <IEnumerable <AdminEventDto> > Handle(GetAllEventsQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Events
            .AsNoTracking()
            .ProjectTo <AdminEventDto>(_mapper.ConfigurationProvider)
            .ToListAsync(cancellationToken));
 }
Esempio n. 2
0
        //
        // GET: /Data/
        public ActionResult Index(string appToken, string eventHash = null)
        {
            ViewBag.Token = appToken;

            if (eventHash == null)
            {
                var query = new GetAllEventsQuery();
                ViewBag.Events = query.Execute(appToken);
                return View("Dashboard");
            }
            else
            {
                var query = new GetSingleEventQuery();
                ViewBag.Event = query.Execute(appToken, eventHash);
                return View("EventDetails");
            }
        }
Esempio n. 3
0
 public async Task <List <EventsListViewModel> > Handle(GetAllEventsQuery request, CancellationToken cancellationToken)
 {
     return(await DataContext.Events
            .Include(m => m.Attendees)
            .Include(m => m.EventGuides)
            .ThenInclude(m => m.Guide)
            .ThenInclude(m => m.Person)
            .Select(m => new EventsListViewModel
     {
         Id = m.Id,
         EventName = m.EventName,
         EventStatus = m.EventStatus.Title,
         EventDate = m.EventDate,
         Guides = string.Join(", ", m.EventGuides.Select(n => new { Name = n.Guide.Person.FirstName + " " + n.Guide.Person.LastName })
                              .OrderBy(p => p.Name)
                              .Select(q => q.Name)),
         Attendees = m.Attendees.Count()
     }).ToListAsync(cancellationToken));
 }
Esempio n. 4
0
        /// <summary>
        /// Pre-populates the create new event form to edit an event based on its event id
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns>Create new event form</returns>
        public ActionResult EditEventDetails(int eventId)
        {
            AdminModel model = new AdminModel();

            if (!AllowAccess())
            {
                return(View(ViewNames.FailedToAuthenticate));
            }

            model.UserLoginName = claimsHelper.GetUserNameFromClaim((ClaimsIdentity)User.Identity);
            GetEventByEventId eventQuery = new GetEventByEventId(eventId);

            model.Event = commandBus.ProcessQuery(eventQuery);

            IEnumerable <TicketCategoryEnum> categoryEnum = Enumeration.GetAll <TicketCategoryEnum>().ToList();
            IEnumerable <SelectListItem>     categoryList = categoryEnum.Select(item => new SelectListItem()
            {
                Text     = item.DisplayValue,
                Value    = item.Id,
                Selected = item.Id.Equals(model.Event.CategoryId.Id)
            });

            model.EventCategories = new SelectList(categoryEnum);

            GetEventPostPictures pictureQuery = new GetEventPostPictures(eventId);

            model.Pictures = commandBus.ProcessQuery(pictureQuery);

            GetTicketClaimsByEventIdQuery ticketClaimQuery = new GetTicketClaimsByEventIdQuery(eventId);

            model.TicketClaims = commandBus.ProcessQuery(ticketClaimQuery);

            GetAllEventsQuery activeEvents = new GetAllEventsQuery();

            model.Events = commandBus.ProcessQuery(activeEvents);

            return(View(ViewNames.AdminHomePage, model));
        }
Esempio n. 5
0
 protected override IQueryable <EventVM> Handle(GetAllEventsQuery request)
 {
     return(dbContext.Events
            .Include(a => a.EventPackage)
            .Include(a => a.Coordinator)
            .Include(a => a.Client)
            .Select(a => new EventVM
     {
         ID = a.ID,
         EventName = a.EventName,
         Location = a.Location,
         BookingDate = a.BookingDate,
         EventDate = a.EventDate,
         Description = a.Description,
         Type = a.Type,
         Package = a.EventPackage,
         Coordinator = a.Coordinator,
         Client = a.Client,
         EventStatus = a.EventStatus,
         Remarks = a.Remarks,
         AdminRemarks = a.AdminRemarks
     }));
 }
Esempio n. 6
0
 /// <inheritdoc />
 public Task <IEnumerable <Event> > Handle(GetAllEventsQuery request, CancellationToken cancellationToken)
 {
     return(_eventRepository.GetEvents(request.CategoryId));
 }
        public async Task <BaseResult <List <Event> > > Handle(GetAllEventsQuery request, CancellationToken cancellationToken)
        {
            var events = await _unitOfWork.EventRepository.GetAllAsync();

            return(BaseResult <List <Event> > .Success(ResultType.Ok, events));
        }
Esempio n. 8
0
 /// <summary>
 /// Handler for the get all events query.
 /// </summary>
 /// <param name="query">the get all events query</param>
 /// <returns>all events (active and otherwise)</returns>
 public List <Event> Handle(GetAllEventsQuery query)
 {
     return(eventRepository.GetAllEvents());
 }
Esempio n. 9
0
 public async Task <IEnumerable <IDomainEvent> > HandleAsync(GetAllEventsQuery query)
 {
     return(await this.eventStore.GetEvents().ConfigureAwait(false));
 }
Esempio n. 10
0
 public Task <List <DemoEvent> > Handle(GetAllEventsQuery request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(_dataAccess.GetEvents()));
 }