Esempio n. 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));
 }
Esempio n. 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);
            }
        }
Esempio n. 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());
        }
Esempio n. 4
0
        public async void Delete_ShouldPass(string id)
        {
            var delete = await _repository.DeletePost(id);

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

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

            return(Ok(post));
        }
Esempio n. 8
0
 public async Task DeletePost(long postId)
 {
     await _postsRepository.DeletePost(postId);
 }