예제 #1
0
 public bool AddCourse(Course v)
 {
     db.Courses.Add(v);
     if (!Save())
     {
         return false;
     }
     return true;
 }
예제 #2
0
 public bool RemoveCourse(Course v)
 {
     if (!db.Courses.Local.Contains(v))
     {
         db.Courses.Attach(v);
     }
     db.Courses.Remove(v);
     if (!Save())
     {
         return false;
     }
     return true;
 }
예제 #3
0
 public bool UpdateCourse(Course v)
 {
     if (!db.Courses.Local.Contains(v))
     {
         db.Courses.Attach(v);
     }
     db.Entry<Course>(v).State = EntityState.Modified;
     if (!Save())
     {
         return false;
     }
     return true;
 }