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); }
public IList <Events> Events() { try { return(_eventsRepository.Get().ToList()); } catch { return(new List <Events>()); } }
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}"); } }
public Def_Events Get(int id) { return(_IEventCategoryRepo.Get(id)); }