// GET: StudentInfoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var studentInfo = _studentBl.GetStudentById(id); if (studentInfo == null) { return(HttpNotFound()); } var vm = _studentBl.EditStudent(studentInfo); ViewBag.GradeId = new SelectList(_gradeBl.GetGrades(), "Id", "ClassName", studentInfo.GradeId); return(View(vm)); }