public async Task <ActionResult> Edit([Bind(Include = "EnrollStudentID,CourseID,TeacherID,StudentID,SemesterID,Score,Remark")] LabScoreModel labScoreModel) { if (ModelState.IsValid) { db.Entry(labScoreModel).State = EntityState.Modified; await db.SaveChangesAsync(); int RecordStored = UpdateLabScore(labScoreModel.EnrollStudentID, labScoreModel.CourseID, labScoreModel.TeacherID, labScoreModel.Score); return(RedirectToAction("Index")); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", labScoreModel.CourseID); ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Session", labScoreModel.SemesterID); ViewBag.StudentID = new SelectList(db.Students, "ProfileID", "StudentName", labScoreModel.StudentID); ViewBag.TeacherID = new SelectList(db.Teachers, "ProfileID", "TeacherName", labScoreModel.TeacherID); return(View(labScoreModel)); }
public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LabScoreModel labScoreModel = await db.LabScores.FindAsync(id); if (labScoreModel == null) { return(HttpNotFound()); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", labScoreModel.CourseID); ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Session", labScoreModel.SemesterID); ViewBag.StudentID = new SelectList(db.Students, "ProfileID", "StudentName", labScoreModel.StudentID); ViewBag.TeacherID = new SelectList(db.Teachers, "ProfileID", "TeacherName", labScoreModel.TeacherID); return(View(labScoreModel)); }