Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddAsync([FromBody] CreateConferenceDto dto)
        {
            await _conferencesService.AddAsync(dto);

            return(Accepted()); // CreateAtRoute || Action
        }