Exemplo n.º 1
0
        public async Task <List <UserEventDto> > GetAttendeesAsync(int eventId)
        {
            var result = await _userEventRepository.GetAttendeesAsync(eventId);

            if (result.Status == RepositoryStatus.Ok)
            {
                var attendees = await result.Entity.ToListAsync();

                return(_mapper.Map <List <UserEvent>, List <UserEventDto> >(attendees));
            }
            if (result.Status == RepositoryStatus.NotFound)
            {
                throw new ServiceException(ErrorCodes.EntityNotFound);
            }
            throw new ServiceException(ErrorCodes.DatabaseError);
        }