Exemplo n.º 1
0
        public async Task <HostDto> GetAsync(Guid id)
        {
            var host = await _hostsRepository.GetAsync(id);

            return(host is null
                ? null
                : Map(host));
        }
Exemplo n.º 2
0
        public async Task AddAsync(CreateConferenceDto dto)
        {
            var host = await _hostsRepository.GetAsync(dto.HostId);

            if (host is null)
            {
                throw new HostNotFoundException(dto.HostId);
            }

            var conference = new Conference(dto.Name, dto.Location, dto.LogoUrl, dto.ParticipantsLimit, dto.From, dto.To, host);

            _conferenceRepository.Add(conference);
            await _conferenceRepository.UnitOfWork.SaveChangesAsync();
        }