public async Task <ActionResult> UpdateAsync(Guid id, HostDetailsDto dto) { dto.Id = id; await _hostService.UpdateAsync(dto); return(NoContent()); }
public async Task AddAsync(HostDetailsDto dto) { dto.Id = Guid.NewGuid(); var host = new Host { Id = dto.Id, Name = dto.Name, Description = dto.Description }; await _hostRepository.AddAsync(host); }
public async Task UpdateAsync(HostDetailsDto dto) { var host = await _hostRepository.GetAsync(dto.Id); if (host is null) { throw new HostNotFoundException(dto.Id); } host.Name = dto.Name; host.Description = dto.Description; await _hostRepository.UpdateAsync(host); }
public async Task <ActionResult> AddAsync(HostDetailsDto dto) { await _hostService.AddAsync(dto); return(CreatedAtAction(nameof(Get), new { id = dto.Id }, null)); }