public ActionResult Create(Subject subject)
        {
            if (ModelState.IsValid)
            {
                _db.Subjects.AddObject(subject);
                _db.SaveChanges();
                return RedirectToAction("Edit", "Course",
                                        new {id = subject.CourseID});
            }

            ViewBag.CourseID = subject.CourseID;
            return View(subject);
        }
        public ActionResult Edit(Subject subject)
        {
            if (ModelState.IsValid)
            {
                _db.Subjects.Attach(subject);
                _db.ObjectStateManager.ChangeObjectState(subject,
                                                         EntityState.Modified);
                _db.SaveChanges();
                return RedirectToAction("Edit", "Course",
                                        new {id = subject.CourseID});
            }

            return View(subject);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Subjects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSubjects(Subject subject)
 {
     base.AddObject("Subjects", subject);
 }
 /// <summary>
 /// Create a new Subject object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="courseID">Initial value of the CourseID property.</param>
 public static Subject CreateSubject(global::System.Int32 id, global::System.String name, global::System.Int32 courseID)
 {
     Subject subject = new Subject();
     subject.ID = id;
     subject.Name = name;
     subject.CourseID = courseID;
     return subject;
 }