Example #1
0
        public ActionResult CommentDeleteConfirmed(int commentId, string password)
        {
            var          comment       = db.Comments.Find(commentId);
            IEncryptable encryptor     = new HashEncryption();
            bool         passwordVaild = encryptor.IsEqual(password, comment.CommentPassword);

            if (passwordVaild)
            {
                db.Comments.Remove(comment);
                db.SaveChanges();
                return(Json("Comment has been deleted successfully!"));
            }
            return(Json("Wrong password!"));
        }