예제 #1
0
        public IActionResult Delete(int id)
        {
            var entity = _newsItemRepository.Get(id);

            CheckIfNotNull(entity);

            _imageService.Remove(entity.Image.PublicId);
            _imageRepository.Remove(entity.Image);
            _newsItemRepository.Remove(entity);
            try
            {
                _unitOfWork.Commit();
            }
            catch (DbUpdateException exc)
            {
            }

            return(RedirectToAction("Index"));
        }