public string Post(FormCollection form) { const string tipFMT = "<script type=\"text/javascript\">alert('{0}')</script>"; string nickname = form["post_name"], title = form["post_title"], tag = form["post_type"], verifyCode = form["verifycode"], content = form["editor"]; if (content.Length == 0) { return(String.Format(tipFMT, "请输入内容")); } else if (verifyCode == "" || !VerifyCode.Verify(verifyCode, true)) { return(String.Format(tipFMT, "验证码不正确!")); } Category catalog = cbll.Get(a => a.Tag == tag); string id = bll.Create(new Archive { Author = nickname, CatalogID = catalog.ID, Content = content, Tags = "", Source = "", Title = title, ViewCount = 1, Visible = true }); return(String.Format("<script type=\"text/javascript\">alert('发布成功!');window.parent.location.href='/s_{0}/';</script>", id)); }
public string Show(string id, FormCollection form) { const string tipFMT = "<script type=\"text/javascript\">alert('{0}')</script>"; string view_name = form["view_name"]; if (String.IsNullOrEmpty(view_name)) { return(String.Format(tipFMT, "名称不能为空!")); } else if (form["verifycode"] == "" || !VerifyCode.Verify(form["verifycode"], true)) { return(String.Format(tipFMT, "验证码不正确!")); } string content = form["editor"]; if (content.Length == 0) { return(String.Format(tipFMT, "请输入内容!")); } //去掉HTML //补充用户 content = String.Format("(u:'{0}'){1}", view_name, content); cmbll.InsertComment(id, 0, content); return("<script type=\"text/javascript\">alert('评论成功!');window.parent.location.reload();</script>"); }