internal object DeleteBlog(int id, string userInfoId) { GetOneById(id); _repo.DeleteBlog(id, userInfoId); string deleted = "Blog deleted"; return(deleted); }
internal void DeleteBlog(int id, string creatorId) { Blog comment = GetOneBlog(id); if (comment.CreatorId != creatorId) { throw new Exception("You cannot delete another users Blog"); } if (!_repo.DeleteBlog(id)) { throw new Exception("Something has gone wrong, review code"); } }