Exemplo n.º 1
0
        public async Task DeleteAsync(Guid id)
        {
            var host = await _hostRepository.GetAsync(id);

            if (host is null)
            {
                throw new HostNotFoundException(id);
            }

            await _hostRepository.DeleteAsync(host);
        }
Exemplo n.º 2
0
        public async Task DeleteAsync(Guid id)
        {
            var host = await _hostRepository.GetAsync(id);

            if (host is null)
            {
                throw new HostNotFoundException(id);
            }

            if (await _hostDeletionPolicy.CanDeleteAsync(host) is false)
            {
                throw new CannotDeleteHostException(id);
            }

            await _hostRepository.DeleteAsync(host);
        }