public ActionResult Edit([Bind(Include = "Class_Prog_Id,Class_Prog_Code,Class_Program_Name,Class_Program_Name_Eng,Order_Id")] Mstr_Class_Program mstr_Class_Program) { if (ModelState.IsValid) { db.Entry(mstr_Class_Program).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateException) { Mstr_Class_Program class_program = db.Mstr_Class_Program.Find(mstr_Class_Program.Class_Prog_Id); if (class_program == null) { return(HttpNotFound()); } TempData["shortMessage"] = "Kode Program Kelas telah ada."; return(RedirectToAction("Edit", mstr_Class_Program)); throw; } return(RedirectToAction("Index")); } return(View(mstr_Class_Program)); }
public ActionResult DeleteConfirmed(int id) { Fnc_Course_Cost_Sks fnc_Course_Cost_Sks = db.Fnc_Course_Cost_Sks.Find(id); Mstr_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == fnc_Course_Cost_Sks.Class_Prog_Id).First(); db.Fnc_Course_Cost_Sks.Remove(fnc_Course_Cost_Sks); db.SaveChanges(); return(RedirectToAction("Index", new { Class_Prog_Id = mstr_Class_Program.Class_Prog_Id, Term_Year_Id = fnc_Course_Cost_Sks.Term_Year_Id })); }
public ActionResult DeleteConfirmed(int id) { Fnc_Cost_Regular fnc_Cost_Regular = db.Fnc_Cost_Regular.Find(id); Mstr_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Where(cp => cp.Class_Prog_Id == fnc_Cost_Regular.Class_Prog_Id).First(); Mstr_Entry_Period_Type mstr_Entry_Period_Type = db.Mstr_Entry_Period_Type.Where(ept => ept.Entry_Period_Type_Id == fnc_Cost_Regular.Entry_Period_Type_Id).First(); db.Fnc_Cost_Regular.Remove(fnc_Cost_Regular); db.SaveChanges(); return(RedirectToAction("Index", new { Class_Prog_Id = mstr_Class_Program.Class_Prog_Id, Term_Year_Id = fnc_Cost_Regular.Term_Year_Id, Department_Id = fnc_Cost_Regular.Department_Id, Entry_Period_Type_Id = mstr_Entry_Period_Type.Entry_Period_Type_Id })); }
public ActionResult Create([Bind(Include = "Class_Prog_Id,Class_Prog_Code,Class_Program_Name,Class_Program_Name_Eng,Order_Id")] Mstr_Class_Program mstr_Class_Program) { if (ModelState.IsValid) { db.Mstr_Class_Program.Add(mstr_Class_Program); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mstr_Class_Program)); }
// GET: Class_Program/Details/5 public ActionResult Details(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mstr_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Find(id); if (mstr_Class_Program == null) { return(HttpNotFound()); } return(View(mstr_Class_Program)); }
// GET: Class_Program/Delete/5 //public ActionResult Delete(short? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // Mstr_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Find(id); // if (mstr_Class_Program == null) // { // return HttpNotFound(); // } // return View(mstr_Class_Program); //} // POST: Class_Program/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(short id) { Mstr_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Find(id); db.Mstr_Class_Program.Remove(mstr_Class_Program); try { db.SaveChanges(); } catch (DbUpdateException) { TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan"; return(RedirectToAction("Index")); } TempData["berhasilHapus"] = "Berhasil Hapus Data."; return(RedirectToAction("Index")); }
// GET: Class_Program/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_Class_Program mstr_Class_Program = db.Mstr_Class_Program.Find(id); if (mstr_Class_Program == null) { return(HttpNotFound()); } return(View(mstr_Class_Program)); }