public async Task <ActionResult> Edit([Bind(Include = "EnrollStudentID,CourseID,TeacherID,StudentID,SemesterID,Score,Remark")] HomeworkScoreModel homeworkScoreModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(homeworkScoreModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                int RecordStored = UpdateHomeworkScore(homeworkScoreModel.EnrollStudentID, homeworkScoreModel.CourseID, homeworkScoreModel.TeacherID, homeworkScoreModel.Score);
                return(RedirectToAction("Index"));
            }
            ViewBag.CourseID   = new SelectList(db.Courses, "CourseID", "CourseName", homeworkScoreModel.CourseID);
            ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Session", homeworkScoreModel.SemesterID);
            ViewBag.StudentID  = new SelectList(db.Students, "ProfileID", "StudentName", homeworkScoreModel.StudentID);
            ViewBag.TeacherID  = new SelectList(db.Teachers, "ProfileID", "TeacherName", homeworkScoreModel.TeacherID);
            return(View(homeworkScoreModel));
        }
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HomeworkScoreModel homeworkScoreModel = await db.HomeworkScores.FindAsync(id);

            if (homeworkScoreModel == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseID   = new SelectList(db.Courses, "CourseID", "CourseName", homeworkScoreModel.CourseID);
            ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Session", homeworkScoreModel.SemesterID);
            ViewBag.StudentID  = new SelectList(db.Students, "ProfileID", "StudentName", homeworkScoreModel.StudentID);
            ViewBag.TeacherID  = new SelectList(db.Teachers, "ProfileID", "TeacherName", homeworkScoreModel.TeacherID);
            return(View(homeworkScoreModel));
        }