예제 #1
0
        public bool Delete(int id)
        {
            var director = _repository.FindById(id);

            _repository.Delete(director);
            return(_repository.SaveChanges());
        }
예제 #2
0
        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}"));
            }
        }