public async Task <Unit> Handle(DeleteJobTitleCommand request, CancellationToken cancellationToken)
            {
                _logger.LogInformation("Deleting job title {@Id}", request.Id);

                await _jobTitleRepository.Delete(request.Id);

                return(Unit.Value);
            }
Exemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            var _jobtitleDb = _jobtitleRepository.GetSingle(id);

            if (_jobtitleDb == null)
            {
                return(NotFound());
            }

            _jobtitleRepository.Delete(_jobtitleDb);

            if (!_jobtitleRepository.Commit())
            {
                throw new Exception($"Deleting Job Title {id} failed on commit");
            }

            _logger.LogInformation(100, $"Job Title {id} was deleted.");

            return(NoContent());
        }