コード例 #1
0
ファイル: TweetService.cs プロジェクト: RouSage/TwitterCopy
 /// <summary>
 /// Removes a Tweet entity from the database and breaks all
 /// relations for 'RepliesFrom' and 'RepliesTo' properties
 /// </summary>
 /// <param name="tweetToDelete"></param>
 /// <returns></returns>
 public async Task DeleteTweet(Tweet tweetToDelete)
 {
     if (tweetToDelete.RepliesTo.Count > 0)
     {
         tweetToDelete.RepliesTo.Clear();
     }
     if (tweetToDelete.RepliesFrom.Count > 0)
     {
         tweetToDelete.RepliesFrom.Clear();
     }
     _tweetRepository.Delete(tweetToDelete);
     await _tweetRepository.SaveAsync();
 }
コード例 #2
0
        public bool DeleteTweet(string tweetId)
        {
            bool isDeleted = false;

            try
            {
                isDeleted = _tweetRepository.Delete(tweetId);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                isDeleted = false;
            }
            return(isDeleted);
        }
コード例 #3
0
 public void Delete(DeleteTweet request) => _tweetRepo.Delete(request.Id);
コード例 #4
0
 public void Delete(int id)
 {
     repository.Delete(id);
 }