public ActionResult DeleteConfirmed(int id) { Kewan kewan = db.Kewans.Find(id); db.Kewans.Remove(kewan); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "KewanId,JenengKewan,AnakeKewan,KategoriId")] Kewan kewan) { if (ModelState.IsValid) { db.Entry(kewan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.KategoriId = new SelectList(db.Kategoris, "KategoriId", "Jenis", kewan.KategoriId); return(View(kewan)); }
public ActionResult Create([Bind(Include = "KewanId,JenengKewan,AnakeKewan,KategoriId")] Kewan kewan) { if (ModelState.IsValid) { db.Kewans.Add(kewan); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.KategoriId = new SelectList(db.Kategoris, "KategoriId", "Jenis", kewan.KategoriId); return(View(kewan)); }
// GET: /Kewan/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Kewan kewan = db.Kewans.Find(id); if (kewan == null) { return(HttpNotFound()); } return(View(kewan)); }
// GET: /Kewan/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Kewan kewan = db.Kewans.Find(id); if (kewan == null) { return(HttpNotFound()); } ViewBag.KategoriId = new SelectList(db.Kategoris, "KategoriId", "Jenis", kewan.KategoriId); return(View(kewan)); }