Beispiel #1
0
 public Task <DnsServerDto> UpdateDnsServer(Guid id, UpdateDnsServerData data)
 {
     if (id != data.Id)
     {
         throw new BadDataException(ErrorCode.IdsDontMatch);
     }
     return(_dnsServersService.UpdateDnsServerAsync(data));
 }
        public async Task <DnsServerDto> UpdateDnsServerAsync(UpdateDnsServerData data)
        {
            var server = await GetDnsServerAsync(data.Id)
                         ?? throw new NotFoundException($"No DnsServer found with id {data.Id}.");

            _mapper.Map(data, server);

            await _context.SaveChangesAsync();

            return(_mapper.Map <DnsServerDto>(server));
        }