public ActionResult DeleteConfirmed(int id) { AssessmentGrade assessmentGrade = db.AssessmentGrades.Find(id); db.AssessmentGrades.Remove(assessmentGrade); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AssessmentGradeID,Grade,Grade4,GradeP,GradeS,GradeItemID,EnrollID")] AssessmentGrade assessmentGrade) { if (ModelState.IsValid) { db.Entry(assessmentGrade).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EnrollID = new SelectList(db.Enrolls, "EnrollID", "EnrollID", assessmentGrade.EnrollID); ViewBag.GradeItemID = new SelectList(db.GradeItems, "GradeItemID", "Name", assessmentGrade.GradeItemID); return(View(assessmentGrade)); }
// GET: AssessmentGrades/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AssessmentGrade assessmentGrade = db.AssessmentGrades.Find(id); if (assessmentGrade == null) { return(HttpNotFound()); } return(View(assessmentGrade)); }
// GET: AssessmentGrades/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AssessmentGrade assessmentGrade = db.AssessmentGrades.Find(id); if (assessmentGrade == null) { return(HttpNotFound()); } ViewBag.EnrollID = new SelectList(db.Enrolls, "EnrollID", "EnrollID", assessmentGrade.EnrollID); ViewBag.GradeItemID = new SelectList(db.GradeItems, "GradeItemID", "Name", assessmentGrade.GradeItemID); return(View(assessmentGrade)); }
public ActionResult Uploaded() { if (TempData["fileName"] != null) { string fileName = (string)TempData["fileName"]; var engine = new FileHelperEngine <GradeVM>(); var records = engine.ReadFile(fileName); int EnrId; int GradeDistId; int grItem; foreach (var rec in records) { //EnrId = db.Enrolls.Where(x => x.SectionID == rec.CRN && x.StudentID == rec.StudentId).FirstOrDefault().EnrollID; var enr = db.Enrolls.Where(x => x.SectionID == rec.CRN && x.StudentID == rec.StudentId).FirstOrDefault(); //GradeDistId = db.Sections.Where(x => x.SectionID == rec.CRN).FirstOrDefault().GradeDistributionID; GradeDistId = enr.Section.GradeDistributionID; var Item = db.GradeItems.Where(x => x.Name == rec.Code && x.GradeDistributionID == GradeDistId).FirstOrDefault(); if (Item == null) { continue; } grItem = Item.GradeItemID; if (db.AssessmentGrades.Any(x => x.GradeItemID == grItem && x.EnrollID == enr.EnrollID)) { continue; } var gr = new AssessmentGrade() { EnrollID = enr.EnrollID, Grade = rec.Grade, GradeItemID = grItem, GradeS = rec.GradeS }; db.AssessmentGrades.Add(gr); db.SaveChanges(); } return(View(records)); } return(View()); }