public ActionResult Index(int id) { var course = CourseServiceCaller.Get(id); ViewBag.CourseName = course.Name; ViewBag.CourseId = id; var noteList = NoteServiceCaller.GetAll().Where(x => x.CourseId == id); return(View(noteList)); }
public ActionResult AddNote(int id, string content) { var course = CourseServiceCaller.Get(id); var newNote = new NoteModel() { CourseName = course.Name, CourseId = course.Id, Information = content }; ViewBag.CourseId = id; NoteServiceCaller.Add(newNote); return(RedirectToAction("Index", new { Id = id })); }