Пример #1
0
 public ActionResult DeletePost(int Id)
 {
     try
     {
         var CommentDeleted = _commentService.DeleteByPostId(Id);
         var LikesDeleted   = _likeService.DeleteByPostId(Id);
         if (CommentDeleted && LikesDeleted)
         {
             var PostDeleted = _postService.Delete(Id);
             return(Ok(new ResponseFormat
             {
                 Success = true
             }));
         }
         return(BadRequest(new ResponseFormat
         {
             Success = false,
             Error = true,
             ErrorMessage = "We can not delete this post at the moment, Please try again Later"
         }));
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(BadRequest(new ResponseFormat
         {
             Success = false,
             Error = true,
             ErrorMessage = "We can not delete this post at the moment, Please try again Later"
         }));
     }
 }