Esempio n. 1
0
        public ActionResult <EventDetailDto> Get(string id)
        {
            var scheduledEvent = _eventsRepo.Get(id);

            if (scheduledEvent == null)
            {
                return(NotFound());
            }

            var posters  = _postersRepo.Find(x => x.ScheduledEventId == id);
            var eventDto = _mapper.Map <EventDetailDto>(scheduledEvent);

            eventDto.Posters = posters.Select(x => x.Id).ToArray();
            return(eventDto);
        }
Esempio n. 2
0
 public IList <Events> Events()
 {
     try
     {
         return(_eventsRepository.Get().ToList());
     }
     catch
     {
         return(new List <Events>());
     }
 }
Esempio n. 3
0
        public async Task <T> Get(TId id, CancellationToken cancellationToken)
        {
            try
            {
                var events = await _eventsRepository.Get(id.StreamName, cancellationToken);

                var constructor = typeof(T).GetConstructor(
                    BindingFlags.NonPublic | BindingFlags.Instance,
                    null,
                    new [] { id.GetType(), typeof(IReadOnlyCollection <IDomainEvent>) },
                    null
                    );
                var aggregate = (T)constructor?.Invoke(new object[] { id, events });

                return(aggregate);
            }
            catch (Exception e)
            {
                throw new DomainException($"There was an error loading the aggregate: {e.Message}");
            }
        }
Esempio n. 4
0
 public Def_Events Get(int id)
 {
     return(_IEventCategoryRepo.Get(id));
 }