コード例 #1
0
        public ActionResult DeleteComment(JObject jObject)
        {
            dynamic info = jObject;
            User    user = userDAO.GetUser((string)info.username);

            if (user.Role == "admin")
            {
                if (postDAO.DeletePost((int)info.postId))
                {
                    return(StatusCode(204));
                }
                else
                {
                    return(NotFound());
                }
            }
            else if (moderatorDAO.IsModerator((int)info.userId, (int)info.forumId))
            {
                if (postDAO.DeletePost((int)info.postId))
                {
                    return(StatusCode(204));
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(StatusCode(401));
            }
        }
コード例 #2
0
        public ActionResult DeletePost(int id, Post post)
        {
            Post posts = _postService.GetPost(id);

            _postService.DeletePost(post);

            return(RedirectToAction("GetPostsByDiscussion", "Discussion", new { id = post.Discussion.Id }));
        }
コード例 #3
0
 public void DeletePost(Post post)
 {
     _dao.DeletePost(post);
 }