示例#1
0
        public ActionResult Create(Course course)
        {
            if (ModelState.IsValid)
            {
                ds.Create(course);
                return RedirectToAction("Index");
            }

            return View(course);
        }
示例#2
0
 // Method for updating courses
 public void Update(Course item)
 {
     dc.Entry(item).State = EntityState.Modified;
     dc.SaveChanges();
 }
示例#3
0
 // Method for creating courses
 public int Create(Course course)
 {
     dc.Courses.Add(course);
     dc.SaveChanges();
     return course.Id;
 }