public ActionResult Edit([Bind(Include = "Register_Status_Id,Register_Status_Code,Register_Status_Name,Register_Status_Acronym,Order_Id")] Mstr_Register_Status mstr_Register_Status) { if (ModelState.IsValid) { db.Entry(mstr_Register_Status).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateException) { Mstr_Register_Status register_status = db.Mstr_Register_Status.Find(mstr_Register_Status.Register_Status_Id); if (register_status == null) { return(HttpNotFound()); } TempData["shortMessage"] = "Kode Status Daftar telah ada."; return(RedirectToAction("Edit", mstr_Register_Status)); throw; } return(RedirectToAction("Index")); } return(View(mstr_Register_Status)); }
public ActionResult Create([Bind(Include = "Register_Status_Id,Register_Status_Code,Register_Status_Name,Register_Status_Acronym,Order_Id")] Mstr_Register_Status mstr_Register_Status) { if (ModelState.IsValid) { db.Mstr_Register_Status.Add(mstr_Register_Status); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mstr_Register_Status)); }
// GET: RegisterStatus/Details/5 public ActionResult Details(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mstr_Register_Status mstr_Register_Status = db.Mstr_Register_Status.Find(id); if (mstr_Register_Status == null) { return(HttpNotFound()); } return(View(mstr_Register_Status)); }
// GET: RegisterStatus/Delete/5 //public ActionResult Delete(short? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // Mstr_Register_Status mstr_Register_Status = db.Mstr_Register_Status.Find(id); // if (mstr_Register_Status == null) // { // return HttpNotFound(); // } // return View(mstr_Register_Status); //} // POST: RegisterStatus/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(short id) { Mstr_Register_Status mstr_Register_Status = db.Mstr_Register_Status.Find(id); db.Mstr_Register_Status.Remove(mstr_Register_Status); try { db.SaveChanges(); } catch (DbUpdateException) { TempData["gagalHapus"] = "Gagal Hapus, Data sudah digunakan"; return(RedirectToAction("Index")); } TempData["berhasilHapus"] = "Berhasil Hapus Data."; return(RedirectToAction("Index")); }
// GET: RegisterStatus/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_Register_Status mstr_Register_Status = db.Mstr_Register_Status.Find(id); if (mstr_Register_Status == null) { return(HttpNotFound()); } return(View(mstr_Register_Status)); }