public ActionResult Reply(CommentChild c) { using (BusinessDataBaseEntities db = new BusinessDataBaseEntities()) { //var data = from cc in db.CommentChilds // join cm in db.CommentMains // on cc.CommentMainID equals cm.CommentMainID // select new // { // cm.CommentMainID, // postperson = cm.EmployeeID, // cm.CommentName, // replyperson = cc.EmployeeID, // }; int empid = EmployeeDetail.EmployeeID; db.Entry(c).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "已送出回覆" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteConfirmed(int id) { CommentChild commentChild = db.CommentChilds.Find(id); db.CommentChilds.Remove(commentChild); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CommentMainID,Num,EmployeeID,CommentQuestionID,Rate,ReplyTime")] CommentChild commentChild) { if (ModelState.IsValid) { db.Entry(commentChild).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CommentMainID = new SelectList(db.CommentMains, "CommentMainID", "CommentName", commentChild.CommentMainID); ViewBag.CommentQuestionID = new SelectList(db.CommentQuestions, "CommentQuestionID", "Question", commentChild.CommentQuestionID); ViewBag.EmployeeID = new SelectList(db.Employees, "employeeID", "EmployeeName", commentChild.EmployeeID); return(View(commentChild)); }
// GET: CommentChilds/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentChild commentChild = db.CommentChilds.Find(id); if (commentChild == null) { return(HttpNotFound()); } return(View(commentChild)); }
// GET: CommentChilds/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentChild commentChild = db.CommentChilds.Find(id); if (commentChild == null) { return(HttpNotFound()); } ViewBag.CommentMainID = new SelectList(db.CommentMains, "CommentMainID", "CommentName", commentChild.CommentMainID); ViewBag.CommentQuestionID = new SelectList(db.CommentQuestions, "CommentQuestionID", "Question", commentChild.CommentQuestionID); ViewBag.EmployeeID = new SelectList(db.Employees, "employeeID", "EmployeeName", commentChild.EmployeeID); return(View(commentChild)); }