public ActionResult DeleteConfirmed(int id) { BATCH bATCH = db.BATCHes.Find(id); db.BATCHes.Remove(bATCH); db.SaveChanges(); return(RedirectToAction("ManageBatches")); }
public ActionResult Edit([Bind(Include = "ID,NAME,CRS_ID,START_DATE,END_DATE,IS_DEL,EMP_ID")] BATCH bATCH) { if (ModelState.IsValid) { db.Entry(bATCH).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ManageBatches")); } ViewBag.CRS_ID = new SelectList(db.COURSEs, "ID", "CRS_NAME", bATCH.CRS_ID); return(View(bATCH)); }
// GET: BATCH/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BATCH bATCH = db.BATCHes.Find(id); if (bATCH == null) { return(HttpNotFound()); } return(View(bATCH)); }
public ActionResult Create([Bind(Include = "ID,NAME,CRS_ID,START_DATE,END_DATE,IS_DEL,EMP_ID")] BATCH bATCH) { if (ModelState.IsValid) { bATCH.IS_DEL = "N"; bATCH.EMP_ID = Convert.ToInt32(this.Session["UserId"]); db.BATCHes.Add(bATCH); db.SaveChanges(); return(RedirectToAction("ManageBatches")); } ViewBag.CRS_ID = new SelectList(db.COURSEs, "ID", "CRS_NAME", bATCH.CRS_ID); return(View(bATCH)); }
// GET: BATCH/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BATCH bATCH = db.BATCHes.Find(id); if (bATCH == null) { return(HttpNotFound()); } ViewBag.CRS_ID = new SelectList(db.COURSEs, "ID", "CRS_NAME", bATCH.CRS_ID); return(View(bATCH)); }
public ActionResult Create([Bind(Include = "ID,CRS_NAME,CODE,SECTN_NAME,IS_DEL,CREATED_AT,UPDATED_AT,GRADING_TYPE")] COURSE cOURSE, string BATCH_NAME, DateTime ReturnDate, DateTime ReturnDate2) { if (ModelState.IsValid) { cOURSE.IS_DEL = "N"; cOURSE.CREATED_AT = System.DateTime.Now; cOURSE.UPDATED_AT = System.DateTime.Now; db.COURSEs.Add(cOURSE); db.SaveChanges(); BATCH bATCH = new BATCH(); bATCH.NAME = BATCH_NAME; bATCH.START_DATE = ReturnDate; bATCH.END_DATE = ReturnDate2; bATCH.CRS_ID = cOURSE.ID; bATCH.IS_DEL = "N"; db.BATCHes.Add(bATCH); db.SaveChanges(); ViewBag.Message = "Course created successfully!"; DateTime PDate = Convert.ToDateTime(ReturnDate); ViewBag.ReturnDate = PDate.ToShortDateString(); DateTime PDate2 = Convert.ToDateTime(ReturnDate2); ViewBag.ReturnDate2 = PDate2.ToShortDateString(); ViewBag.BATCH_NAME = BATCH_NAME; var GradingLevelList = new SelectList(new[] { new { ID = "Normal", Name = "Normal" }, new { ID = "GPA", Name = "GPA" }, new { ID = "CWA", Name = "CWA" }, new { ID = "CCE", Name = "CCE" }, new { ID = "ICSE", Name = "ICSE" }, }, "ID", "Name", "Normal"); ViewData["GRADING_TYPE"] = GradingLevelList; return(View()); } ViewBag.Message = "There is some issue adding course."; return(View(cOURSE)); }