public ActionResult postcomment() { var id = Session["userID"]; string comment = Request["comment"]; var a = Convert.ToInt32(Request.Cookies["id"].Value); var b = Convert.ToInt32(Request.Cookies["b_id"].Value); var name = Session["userName"].ToString(); string logo = Session["userLogo"].ToString(); POSTCOMMENT comm = new POSTCOMMENT(); comm.PC_COMMENTERID = (int)id; comm.PC_COMMENTER = name; comm.PC_PICTURE = logo; comm.PC_POSTID = a; comm.PC_BOARDID = (int)b; comm.PC_CONTENTS = comment; comm.PC_DATETIME = DateTime.Parse(DateTime.Now.ToString()); comm.PC_BAD = 0; comm.PC_GOOD = 0; conn.POSTCOMMENT.Add(comm); conn.SaveChanges(); return(Content("<script>history.go(-1)</script>")); }
public ActionResult pDelete(string id, string co) { if (!string.IsNullOrEmpty(id)) { int pid = System.Convert.ToInt32(id); POST post = conn.POST.Find(pid); conn.POST.Remove(post); conn.SaveChanges(); } if (!string.IsNullOrEmpty(co)) { int cid = System.Convert.ToInt32(co); POSTCOMMENT postcomment = conn.POSTCOMMENT.Find(cid); conn.POSTCOMMENT.Remove(postcomment); conn.SaveChanges(); } return(View()); }