public ActionResult Edit([Bind(Include = "Education_Type_Id,Education_Type_Code,Education_Type_Name,Created_By,Created_Date,Modified_By,Modified_Date")] Mstr_Education_Type mstr_Education_Type) { if (ModelState.IsValid) { db.Entry(mstr_Education_Type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateException) { Mstr_Education_Type EducationType = db.Mstr_Education_Type.Find(mstr_Education_Type.Education_Type_Id); if (EducationType == null) { return(HttpNotFound()); } TempData["shortMessage"] = "Kode Jenjang Pendidikan telah ada."; return(RedirectToAction("Edit", mstr_Education_Type)); throw; } return(RedirectToAction("Index")); } return(View(mstr_Education_Type)); }
public ActionResult Create([Bind(Include = "Education_Type_Id,Education_Type_Code,Education_Type_Name,Created_By,Created_Date,Modified_By,Modified_Date")] Mstr_Education_Type mstr_Education_Type) { if (ModelState.IsValid) { db.Mstr_Education_Type.Add(mstr_Education_Type); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mstr_Education_Type)); }
// GET: EducationType/Details/5 public ActionResult Details(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id); if (mstr_Education_Type == null) { return(HttpNotFound()); } return(View(mstr_Education_Type)); }
// GET: EducationType/Delete/5 //public ActionResult Delete(short? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id); // if (mstr_Education_Type == null) // { // return HttpNotFound(); // } // return View(mstr_Education_Type); //} // POST: EducationType/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(short id) { Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id); db.Mstr_Education_Type.Remove(mstr_Education_Type); try { db.SaveChanges(); } catch (DbUpdateException) { TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan"; return(RedirectToAction("Index")); } TempData["berhasilHapus"] = "Berhasil Hapus Data."; return(RedirectToAction("Index")); }
// GET: EducationType/Edit/5 public ActionResult Edit(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (TempData["shortMessage"] != null) { ViewBag.message = TempData["shortMessage"].ToString(); } Mstr_Education_Type mstr_Education_Type = db.Mstr_Education_Type.Find(id); if (mstr_Education_Type == null) { return(HttpNotFound()); } return(View(mstr_Education_Type)); }