public ActionResult Edit([Bind(Include = "High_School_Major_Id,High_School_Major_Code,High_School_Major_Name,Order_Id")] Mstr_High_School_Major mstr_High_School_Major) { if (ModelState.IsValid) { db.Entry(mstr_High_School_Major).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateException) { Mstr_High_School_Major high_school_major = db.Mstr_High_School_Major.Find(mstr_High_School_Major.High_School_Major_Id); if (high_school_major == null) { return(HttpNotFound()); } TempData["shortMessage"] = "Kode Jurusan SMA Asal telah ada."; return(RedirectToAction("Edit", mstr_High_School_Major)); throw; } return(RedirectToAction("Index")); } return(View(mstr_High_School_Major)); }
public ActionResult Create([Bind(Include = "High_School_Major_Id,High_School_Major_Code,High_School_Major_Name,Order_Id")] Mstr_High_School_Major mstr_High_School_Major) { if (ModelState.IsValid) { db.Mstr_High_School_Major.Add(mstr_High_School_Major); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mstr_High_School_Major)); }
// GET: HighSchoolMajor/Details/5 public ActionResult Details(byte?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mstr_High_School_Major mstr_High_School_Major = db.Mstr_High_School_Major.Find(id); if (mstr_High_School_Major == null) { return(HttpNotFound()); } return(View(mstr_High_School_Major)); }
// GET: HighSchoolMajor/Delete/5 //public ActionResult Delete(byte? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // Mstr_High_School_Major mstr_High_School_Major = db.Mstr_High_School_Major.Find(id); // if (mstr_High_School_Major == null) // { // return HttpNotFound(); // } // return View(mstr_High_School_Major); //} // POST: HighSchoolMajor/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(byte id) { Mstr_High_School_Major mstr_High_School_Major = db.Mstr_High_School_Major.Find(id); db.Mstr_High_School_Major.Remove(mstr_High_School_Major); try { db.SaveChanges(); } catch (DbUpdateException) { TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan"; return(RedirectToAction("Index")); } TempData["berhasilHapus"] = "Berhasil Hapus Data."; return(RedirectToAction("Index")); }
// GET: HighSchoolMajor/Edit/5 public ActionResult Edit(byte?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (TempData["shortMessage"] != null) { ViewBag.message = TempData["shortMessage"].ToString(); } Mstr_High_School_Major mstr_High_School_Major = db.Mstr_High_School_Major.Find(id); if (mstr_High_School_Major == null) { return(HttpNotFound()); } return(View(mstr_High_School_Major)); }