Ejemplo n.º 1
0
 public int Update(Program item)
 {
     using (var context = new ContextStarTED())
     {
         context.Entry(item).State = System.Data.Entity.EntityState.Modified;
         return(context.SaveChanges());
     }
 }
Ejemplo n.º 2
0
 public int Add(Program item)
 {
     using (var context = new ContextStarTED())
     {
         context.Programs.Add(item);
         context.SaveChanges();
         return(item.ProgramID);
     }
 }
Ejemplo n.º 3
0
 public string Add(School item)
 {
     using (var context = new ContextStarTED())
     {
         context.Schools.Add(item);
         context.SaveChanges();
         return(item.SchoolCode);
     }
 }
Ejemplo n.º 4
0
 public int Delete(int programid)
 {
     using (var context = new ContextStarTED())
     {
         var existing = context.Programs.Find(programid);
         if (existing == null)
         {
             throw new Exception("Record has been removed from database");
         }
         context.Programs.Remove(existing);
         return(context.SaveChanges());
     }
 }
Ejemplo n.º 5
0
 public int Delete(string schoolCode)
 {
     using (var context = new ContextStarTED())
     {
         var existing = context.Schools.Find(schoolCode);
         if (existing == null)
         {
             throw new Exception("Record has been removed from database");
         }
         context.Schools.Remove(existing);
         return(context.SaveChanges());
     }
 }