Example #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)));
        }
Example #2
0
        //DELORT
        internal Blog Delete(string id)
        {
            Blog original = GetById(id);

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

            if (_repo.Delete(id))
            {
                return(foundBlog);
            }
            throw new Exception("something failed");
        }
Example #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...");
        }
Example #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...");
            }
            ;
        }
Example #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");
        }
Example #10
0
 internal string Delete(int id, string userId)
 {
     GetById(id);
     _repo.Delete(id, userId);
     return("Blog Deleted");
 }