public ActionResult DeleteConfirmed(int id) { RepLi repLi = db.RepLis.Find(id); db.RepLis.Remove(repLi); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ViewRep([Bind(Include = "Repli_ID,Repli_DateCreate,Repli_Content,Comment_ID,User_ID")] RepLi repLi) { User user = (User)Session["user"]; repLi.User_ID = user.User_ID; repLi.Repli_DateCreate = DateTime.Now; db.RepLis.Add(repLi); db.SaveChanges(); return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult Edit([Bind(Include = "Repli_ID,Repli_DateCreate,Repli_Content,Comment_ID,User_ID")] RepLi repLi) { if (ModelState.IsValid) { db.Entry(repLi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Comment_ID = new SelectList(db.Comments, "Comment_ID", "Comment_Content", repLi.Comment_ID); ViewBag.User_ID = new SelectList(db.Users, "User_ID", "User_LastName", repLi.User_ID); return(View(repLi)); }
public ActionResult Create([Bind(Include = "Repli_ID,Repli_DateCreate,Repli_Content,Comment_ID,User_ID")] RepLi repLi) { if (ModelState.IsValid) { db.RepLis.Add(repLi); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Comment_ID = new SelectList(db.Comments, "Comment_ID", "Comment_Content", repLi.Comment_ID); ViewBag.User_ID = new SelectList(db.Users, "User_ID", "User_LastName", repLi.User_ID); return(View(repLi)); }
// GET: RepLis/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RepLi repLi = db.RepLis.Find(id); if (repLi == null) { return(HttpNotFound()); } return(View(repLi)); }
// GET: RepLis/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RepLi repLi = db.RepLis.Find(id); if (repLi == null) { return(HttpNotFound()); } ViewBag.Comment_ID = new SelectList(db.Comments, "Comment_ID", "Comment_Content", repLi.Comment_ID); ViewBag.User_ID = new SelectList(db.Users, "User_ID", "User_LastName", repLi.User_ID); return(View(repLi)); }
public ActionResult EditRep(FormCollection f, int?id) { User user = (User)Session["user"]; String sID = f["Repli_ID"].ToString(); String sContent = f["Repli_Content"].ToString(); id = Int32.Parse(sID); RepLi rep = db.RepLis.SingleOrDefault(n => n.Repli_ID == id && n.User_ID == user.User_ID); if (user != null) { db.RepLis.Find(id).Repli_Content = sContent; db.RepLis.Find(id).Repli_DateCreate = rep.Repli_DateCreate; db.RepLis.Find(id).User_ID = user.User_ID; db.RepLis.Find(id).Comment_ID = rep.Comment_ID; db.SaveChanges(); return(Redirect(Request.UrlReferrer.ToString())); } else { return(Redirect(Request.UrlReferrer.ToString())); } }