public ActionResult DeleteConfirmed(int id) { Punshment punshment = db.Punshments.Find(id); punshment.Delete = true; //db.Punshments.Remove(punshment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "index,BabyNameID,PunshmentActions,StartTime,Delete,Notes,IPAddress,Longitude,Latitude,LiquidSizeID")] Punshment punshment) { if (ModelState.IsValid) { db.Entry(punshment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BabyNameID = new SelectList(db.BabyNames, "ID", "BabyName1", punshment.BabyNameID); ViewBag.PunshmentActions = new SelectList(db.PunshmentActions, "index", "Title", punshment.PunshmentActions); return(View(punshment)); }
// GET: Baby/Punshments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Punshment punshment = db.Punshments.Find(id); if (punshment == null) { return(HttpNotFound()); } return(View(punshment)); }
// GET: Baby/Punshments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Punshment punshment = db.Punshments.Find(id); if (punshment == null) { return(HttpNotFound()); } ViewBag.BabyNameID = new SelectList(db.BabyNames, "ID", "BabyName1", punshment.BabyNameID); ViewBag.PunshmentActions = new SelectList(db.PunshmentActions, "index", "Title", punshment.PunshmentActions); return(View(punshment)); }