예제 #1
0
        public IActionResult Delete(int Id, string ImagePath)
        {
            var result = _blogsRepository.Delete(Id);

            if (result.Succeed)
            {
                _blogGalleryRepository.DeleteByBlogId(Id);
            }
            //FileHelper.DeleteFile(ImagePath, _fileConfig, FileType.Image, _environment.WebRootPath);

            TempData.AddResult(result);
            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
        //DELORT
        internal Blog Delete(string id)
        {
            Blog original = GetById(id);

            _repo.Delete(id);
            return(original);;
        }
예제 #3
0
 public string Delete(int id)
 {
     if (_repo.Delete(id))
     {
         return("Deleted!");
     }
     throw new Exception("Failure");
 }
예제 #4
0
        internal Blog Delete(int id)
        {
            Blog foundBlog = GetById(id);

            if (_repo.Delete(id))
            {
                return(foundBlog);
            }
            throw new Exception("something failed");
        }
예제 #5
0
        internal Blog Delete(int id)
        {
            Blog foundBlog = GetById(id);

            if (_repo.Delete(id))
            {
                return(foundBlog);
            }
            throw new Exception("Sometihng went wrong with the delete...");
        }
        public string Delete(int id)
        {
            Blog foundBlog = GetById(id);

            if (_repo.Delete(id))
            {
                return("Great Success, Delorted.");
            }
            throw new Exception("Yeah, no, that didnt work.");
        }
        internal Blog Delete(int id)
        {
            Blog foundBlog = GetById(id);

            if (_repo.Delete(id))
            {
                return(foundBlog);
            }
            throw new Exception("Something bad happened...");
        }
예제 #8
0
        internal void Delete(int id, string creatorId)
        {
            Blog blog = GetById(id);

            if (blog.CreatorId != creatorId)
            {
                throw new Exception("You cannot delete another users Blog");
            }
            if (!_repo.Delete(id))
            {
                throw new Exception("Something has gone wrong...");
            }
            ;
        }
예제 #9
0
        internal Blog Delete(int id, string userId)
        {
            Blog found = Get(id);

            if (found.AuthorId != userId)
            {
                throw new Exception("Invalid Request");
            }
            if (_repo.Delete(id))
            {
                return(found);
            }
            throw new Exception("Something went terribly wrong");
        }
예제 #10
0
 internal string Delete(int id, string userId)
 {
     GetById(id);
     _repo.Delete(id, userId);
     return("Blog Deleted");
 }