public ActionResult DeleteConfirmed(int id) { BG_OTCredit bg_otcredit = db.BG_OTCredit.Find(id); db.BG_OTCredit.Remove(bg_otcredit); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: /Attendance/OTCredit/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BG_OTCredit bg_otcredit = db.BG_OTCredit.Find(id); if (bg_otcredit == null) { return(HttpNotFound()); } return(View(bg_otcredit)); }
// GET: /Attendance/OTCredit/Edit/5 public ActionResult Edit(int?id) { ViewBag.BOTDivID = new SelectList(db.HR_Department.OrderBy(aa => aa.DepartmentName).ToList(), "DeptID", "DepartmentName"); ViewBag.FinYearID = new SelectList(db.PR_FinYear.OrderBy(aa => aa.FinYearName).ToList(), "PFinYearID", "FinYearName"); //ViewBag.BOTDivID = new SelectList(db.BG_OTDivision, "PBDivID", "PBDivID", bg_otcredit.BOTDivID); //ViewBag.FinYearID = new SelectList(db.PR_FinYear, "PFinYearID", "FinYearName", bg_otcredit.FinYearID); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BG_OTCredit bg_otcredit = db.BG_OTCredit.Find(id); db.BG_OTCredit.Add(bg_otcredit); db.SaveChanges(); if (bg_otcredit == null) { return(HttpNotFound()); } return(View(bg_otcredit)); }
public ActionResult Create([Bind(Include = "PCID,BOTDivID,FinYearID,Amount,Remarks")] BG_OTCredit bg_otcredit) { if (ModelState.IsValid) { if (db.BG_OTDivision.Where(aa => aa.DivID == bg_otcredit.BOTDivID && aa.FinYear == bg_otcredit.FinYearID).Count() > 0) { BG_OTDivision bg = new BG_OTDivision(); bg = db.BG_OTDivision.First(aa => aa.DivID == bg_otcredit.BOTDivID && aa.FinYear == bg_otcredit.FinYearID); bg.RemainingBudget = bg.RemainingBudget + bg_otcredit.Amount; db.SaveChanges(); } db.BG_OTCredit.Add(bg_otcredit); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BOTDivID = new SelectList(db.BG_OTDivision, "PBDivID", "PBDivID", bg_otcredit.BOTDivID); ViewBag.FinYearID = new SelectList(db.PR_FinYear, "PFinYearID", "FinYearName", bg_otcredit.FinYearID); return(View(bg_otcredit)); }
public ActionResult Edit([Bind(Include = "PCID,BOTDivID,FinYearID,Amount,Remarks")] BG_OTCredit bg_otcredit) { ViewBag.BOTDivID = new SelectList(db.HR_Department.OrderBy(aa => aa.DepartmentName).ToList(), "DeptID", "DepartmentName"); ViewBag.FinYearID = new SelectList(db.PR_FinYear.OrderBy(aa => aa.FinYearName).ToList(), "PFinYearID", "FinYearName"); //ViewBag.BOTDivID = new SelectList(db.BG_OTDivision, "PBDivID", "PBDivID", bg_otcredit.BOTDivID); //ViewBag.FinYearID = new SelectList(db.PR_FinYear, "PFinYearID", "FinYearName", bg_otcredit.FinYearID); if (ModelState.IsValid) { if (db.BG_OTDivision.Where(aa => aa.DivID == bg_otcredit.BOTDivID && aa.FinYear == bg_otcredit.FinYearID).Count() > 0) { BG_OTDivision bg = new BG_OTDivision(); bg = db.BG_OTDivision.First(aa => aa.DivID == bg_otcredit.BOTDivID && aa.FinYear == bg_otcredit.FinYearID); bg.RemainingBudget = bg.RemainingBudget + bg_otcredit.Amount; db.SaveChanges(); } db.Entry(bg_otcredit).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bg_otcredit)); }