public ActionResult DeleteConfirmed(int id) { YearDegree yearDegree = db.YearDegrees.Find(id); db.YearDegrees.Remove(yearDegree); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "YearDegreeID,Year,DegreeID,Units")] YearDegree yearDegree) { if (ModelState.IsValid) { db.Entry(yearDegree).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DegreeID = new SelectList(db.Degrees, "DegreeID", "DegreeName", yearDegree.DegreeID); return(View(yearDegree)); }
public ActionResult Create([Bind(Include = "YearDegreeID,Year,DegreeID,Units")] YearDegree yearDegree) { if (ModelState.IsValid) { db.YearDegrees.Add(yearDegree); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DegreeID = new SelectList(db.Degrees, "DegreeID", "DegreeName", yearDegree.DegreeID); return(View(yearDegree)); }
// GET: YearDegrees/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } YearDegree yearDegree = db.YearDegrees.Find(id); if (yearDegree == null) { return(HttpNotFound()); } return(View(yearDegree)); }
// GET: YearDegrees/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } YearDegree yearDegree = db.YearDegrees.Find(id); if (yearDegree == null) { return(HttpNotFound()); } ViewBag.DegreeID = new SelectList(db.Degrees, "DegreeID", "DegreeName", yearDegree.DegreeID); return(View(yearDegree)); }
public int RegisterCourse(StudentCours val) { StudentCours added; try { YearDegree deg = new YearDegree(); deg.LectureDegree = "0"; deg.MidtermDegree = "0"; deg.SectionDegree = "0"; deg.Total = "0"; YearDegree yearAdded = context.YearDegrees.Add(deg); context.SaveChanges(); val.YearDegreeID = yearAdded.ID; val.FinalDegree = "0"; added = context.StudentCourses.Add(val); context.SaveChanges(); } catch (Exception exe) { throw; } return(added.ID); }