示例#1
0
 public async Task <bool> DeletePost(string id)
 {
     if (string.IsNullOrWhiteSpace(id))
     {
         throw new ArgumentNullException(nameof(id), "Id cannot be null.");
     }
     return(await _repository.DeletePost(id));
 }
示例#2
0
        public bool DeletePost(string key, string postid, string username, string password, bool publish)
        {
            EnsureUser(username, password).Wait();

            try
            {
                var result = _repo.DeletePost(postid);
                _repo.SaveAll();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#3
0
        public IActionResult PostsDelete([FromBody] List <PostItem> items)
        {
            if (items == null || items.Count == 0)
            {
                return(NotFound());
            }

            foreach (var item in items)
            {
                if (item.IsChecked)
                {
                    _postsRepository.DeletePost(item.Id);
                }
            }
            _postsRepository.SaveAll();
            return(Ok());
        }
示例#4
0
        public async void Delete_ShouldPass(string id)
        {
            var delete = await _repository.DeletePost(id);

            Assert.True(delete);
        }
示例#5
0
 public void DeletePost(int id)
 {
     repository.DeletePost(id);
 }
示例#6
0
        public async Task DeletePost(int postId)
        {
            await _commentsRepository.DeletePostComments(postId);

            await _postsRepository.DeletePost(postId);
        }
示例#7
0
        public async Task <IActionResult> DeletePost(Guid postId)
        {
            var post = await _repo.DeletePost(postId);

            return(Ok(post));
        }
示例#8
0
 public async Task DeletePost(long postId)
 {
     await _postsRepository.DeletePost(postId);
 }