예제 #1
0
 public static bool AddCategory(CATEGORY category)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<CATEGORY>().Add(category);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
예제 #2
0
 public static bool UpdateCategory(CATEGORY category)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Entry(category).State = System.Data.EntityState.Modified;
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
예제 #3
0
 public static COURSE[] GetCoursesByCategory(CATEGORY category)
 {
     COURSE[] courses = null;
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         courses = ctx.COURSEs.Where(c => c.CATEGORY == category.ID).ToArray();
     }
     return courses;
 }