public bool Delete(int id) { var director = _repository.FindById(id); _repository.Delete(director); return(_repository.SaveChanges()); }
public async Task <IActionResult> GetDirectors(int id) { try { _logger.LogInfo($"Get single director with id: {id}"); var director = await _directorRepository.FindById(id); if (director == null) { _logger.LogWarn($"Director with id {id} is not found"); return(NotFound()); } var response = _mapper.Map <DirectorDTO>(director); return(Ok(response)); } catch (Exception ex) { return(InternalError($"Something went wrong: {ex.Message}")); } }