Esempio n. 1
0
        public ActionResult CommentDelete(int id)
        {
            var commentManager = new UserCommentManager();
            var user           = new UserManager().GetUser(int.Parse(Session["UserID"].ToString()));

            commentManager.DeleteComment(user.ID, id);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult CommentDelete(int id)
        {
            var commentManager = new UserCommentManager();
            var user           = new UserManager().GetUser((int)UserID);

            commentManager.DeleteComment(user.ID, id);
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ActionResult CommentDelete(int id)
        {
            var user           = new UserManager().GetUser(int.Parse(Session["UserID"].ToString()));
            var commentManager = new UserCommentManager();
            var list           = commentManager.GetUserComments(user.ID);

            //delete comment if owned by this user
            if (list.Where(c => c.User.ID == user.ID && c.ID == id).Any())
            {
                commentManager.DeleteComment(user.ID, id);
            }

            return(RedirectToAction("Comments"));
        }