Beispiel #1
0
        public ActionResult Edit(int id = 0)
        {
            var grade = gradeRepository.FindById(id);

            if (grade == null)
            {
                return(HttpNotFound());
            }

            var studentList = from student in studentRepository.List select student;
            var bookList    = from book in bookRespository.List select book;
            var chapterList = from chapter in chapterRepository.List select chapter;

            ViewBag.Student_ID = new SelectList(studentList, "StudentId", "Name", grade.Student_ID);
            ViewBag.Book_ID    = new SelectList(bookList, "BookId", "Book_Name", grade.Book_ID);
            ViewBag.Chapter_ID = new SelectList(chapterList, "ChapterID", "ChapterDescription");
            return(PartialView("_Edit", grade));
        }