public String addComment(CommentRedSpots comredspots, string essaycontent, int forumid) { int userid = int.Parse(Session["User_id"].ToString()); if (essaycontent != null || essaycontent.Length != 0) { comredspots.User_id = userid; comredspots.RedSpots_id = forumid; comredspots.Content = essaycontent; comredspots.CommentTime = DateTime.Now; CommentRedSpotsManage.AddCommentRedSpots(comredspots); return("cg"); } else { return("cc"); } //if (content == null || content.Length == 0) //{ // return Content("<script>;alert('评论内容不能为空!');history.go(-1)</script>"); //} //else if (ModelState.IsValid) //{ // comredspots.User_id = userid; // comredspots.RedSpots_id = redspotsid; // comredspots.Content = content; // comredspots.CommentTime = DateTime.Now; // CommentRedSpotsManage.AddCommentRedSpots(comredspots); // return Content("<script>;alert('评论成功!');history.go(-1)</script>"); //} //return RedirectToAction("Details", "RedSpots"); }
public void AddCommentRedSpots(CommentRedSpots comcomredspots) { db.CommentRedSpots.Add(comcomredspots); db.SaveChanges(); }
public static void AddCommentRedSpots(CommentRedSpots comcomredspots) { commred.AddCommentRedSpots(comcomredspots); }