示例#1
0
        /// <inheritdoc/>
        public IEnumerable <GetWorkshopAttendeesQuery.Attendee> GetWorkshopAttendees(GetWorkshopAttendeesQuery query)
        {
            var workshop = _workshopRepository.GetWorkshop(query.Id);

            if (workshop == null)
            {
                throw new NotFoundException();
            }
            else if (workshop.CreatedBy != _userInfo.UserId && !_userInfo.IsAdmin)
            {
                throw new ResourceIsForbiddenException();
            }

            return(_attendanceRepository.GetWorkshopAttendees(query.Id)
                   .Select(a => a.Adapt <GetWorkshopAttendeesQuery.Attendee>()));
        }
示例#2
0
        /// <inheritdoc/>
        public GetWorkshopQuery.Workshop GetWorkshop(GetWorkshopQuery query)
        {
            Workshop workshop = _repository.GetWorkshop(query.Id);

            return(workshop == null ? null : workshop.Adapt <GetWorkshopQuery.Workshop>());
        }
示例#3
0
 public Workshop GetWorkshopById(int id)
 {
     return(repo.GetWorkshop(id));
 }