public ActionResult Edit([Bind(Include = "Cost_Regular_Personal_Id,Camaru_Id,Term_Year_Id,Cost_Item_Id,Bill_Type_Id,Amount,Percentage,Due_Date,Description,Created_By,Created_Date,Modified_By,Modified_Date")] Fnc_Cost_Regular_Personal fnc_Cost_Regular_Personal, string SAmount, string UrlReferrer) { fnc_Cost_Regular_Personal.Amount = (int)decimal.Parse(Regex.Replace(SAmount, @"[^\d.]", "")); if (ModelState.IsValid) { db.Entry(fnc_Cost_Regular_Personal).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateException) { Fnc_Cost_Regular_Personal CostRegularPersonal = db.Fnc_Cost_Regular_Personal.Find(fnc_Cost_Regular_Personal.Cost_Regular_Personal_Id); if (CostRegularPersonal == null) { return(HttpNotFound()); } TempData["shortMessage"] = "Kombinasi Tahun Semester, Item Pembayaran & Jenis Dispensasi telah digunakan."; return(RedirectToAction("Edit", fnc_Cost_Regular_Personal)); throw; } return(Redirect(UrlReferrer)); } //ViewBag.Bill_Type_Id = new SelectList(db.Fnc_Bill_Type, "Bill_Type_Id", "Bill_Type_Name", fnc_Cost_Regular_Personal.Bill_Type_Id); //ViewBag.Cost_Item_Id = new SelectList(db.Fnc_Cost_Item, "Cost_Item_Id", "Cost_Item_Code", fnc_Cost_Regular_Personal.Cost_Item_Id); //ViewBag.Term_Year_Id = new SelectList(db.Mstr_Term_Year, "Term_Year_Id", "Term_Year_Name", fnc_Cost_Regular_Personal.Term_Year_Id); //ViewBag.Camaru_Id = new SelectList(db.Reg_Camaru, "Camaru_Id", "Camaru_Code", fnc_Cost_Regular_Personal.Camaru_Id); return(View(fnc_Cost_Regular_Personal)); }
public ActionResult DeleteConfirmed(int id) { Fnc_Cost_Regular_Personal fnc_Cost_Regular_Personal = db.Fnc_Cost_Regular_Personal.Find(id); db.Fnc_Cost_Regular_Personal.Remove(fnc_Cost_Regular_Personal); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: CostRegPersonNonDPP/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Fnc_Cost_Regular_Personal fnc_Cost_Regular_Personal = db.Fnc_Cost_Regular_Personal.Find(id); if (fnc_Cost_Regular_Personal == null) { return(HttpNotFound()); } return(View(fnc_Cost_Regular_Personal)); }
public ActionResult Create([Bind(Include = "Cost_Regular_Personal_Id,Camaru_Id,Term_Year_Id,Cost_Item_Id,Bill_Type_Id,Amount,Percentage,Due_Date,Description,Created_By,Created_Date,Modified_By,Modified_Date")] Fnc_Cost_Regular_Personal fnc_Cost_Regular_Personal, string SAmount, string UrlReferrer) { fnc_Cost_Regular_Personal.Amount = (int)decimal.Parse(Regex.Replace(SAmount, @"[^\d.]", "")); if (ModelState.IsValid) { db.Fnc_Cost_Regular_Personal.Add(fnc_Cost_Regular_Personal); db.SaveChanges(); return(Redirect(UrlReferrer)); } ViewBag.Bill_Type_Id = new SelectList(db.Fnc_Bill_Type, "Bill_Type_Id", "Bill_Type_Name", fnc_Cost_Regular_Personal.Bill_Type_Id); ViewBag.Cost_Item_Id = new SelectList(db.Fnc_Cost_Item, "Cost_Item_Id", "Cost_Item_Code", fnc_Cost_Regular_Personal.Cost_Item_Id); ViewBag.Term_Year_Id = new SelectList(db.Mstr_Term_Year, "Term_Year_Id", "Term_Year_Name", fnc_Cost_Regular_Personal.Term_Year_Id); ViewBag.Camaru_Id = new SelectList(db.Reg_Camaru, "Camaru_Id", "Camaru_Code", fnc_Cost_Regular_Personal.Camaru_Id); return(View(fnc_Cost_Regular_Personal)); }
// GET: CostRegPersonNonDPP/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (TempData["shortMessage"] != null) { ViewBag.message = TempData["shortMessage"].ToString(); } Fnc_Cost_Regular_Personal fnc_Cost_Regular_Personal = db.Fnc_Cost_Regular_Personal.Find(id); if (fnc_Cost_Regular_Personal == null) { return(HttpNotFound()); } ViewBag.student = db.Acd_Student.Where(s => s.Register_Id == fnc_Cost_Regular_Personal.Camaru_Id).First(); ViewBag.Bill_Type_Id = new SelectList(db.Fnc_Bill_Type, "Bill_Type_Id", "Bill_Type_Name", fnc_Cost_Regular_Personal.Bill_Type_Id); ViewBag.Cost_Item_Id = new SelectList(db.Fnc_Cost_Item.OrderBy(ci => ci.Cost_Item_Name), "Cost_Item_Id", "Cost_Item_Name", fnc_Cost_Regular_Personal.Cost_Item_Id); ViewBag.Term_Year_Id = new SelectList(db.Mstr_Term_Year.OrderByDescending(ty => ty.Term_Year_Id), "Term_Year_Id", "Term_Year_Name", fnc_Cost_Regular_Personal.Term_Year_Id); ViewBag.Camaru_Id = new SelectList(db.Reg_Camaru, "Camaru_Id", "Camaru_Code", fnc_Cost_Regular_Personal.Camaru_Id); ViewBag.UrlReferrer = System.Web.HttpContext.Current.Request.UrlReferrer.ToString(); return(View(fnc_Cost_Regular_Personal)); }