public ActionResult DeleteConfirmed(int id) { Postz postz = db.RebbitPosts.Find(id); db.RebbitPosts.Remove(postz); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Title,TimePosted,Upvote,Downvote,ImageUrl,Description,UserId")] Postz postz) { if (ModelState.IsValid) { db.Entry(postz).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postz)); }
public ActionResult Create([Bind(Include = "Title,ImageUrl,Description")] Postz postz) { if (ModelState.IsValid) { db.RebbitPosts.Add(postz); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(postz)); }
// GET: Postzs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Postz postz = db.RebbitPosts.Find(id); if (postz == null) { return(HttpNotFound()); } return(View(postz)); }