public ActionResult Create(Course course) { if (ModelState.IsValid) { ds.Create(course); return RedirectToAction("Index"); } return View(course); }
// Method for updating courses public void Update(Course item) { dc.Entry(item).State = EntityState.Modified; dc.SaveChanges(); }
// Method for creating courses public int Create(Course course) { dc.Courses.Add(course); dc.SaveChanges(); return course.Id; }