Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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");
 }