예제 #1
0
 public static parents GetParentById(string id)
 {
     using (var context = new PARENTSEntities())
     {
         parents parentList = context.parents.FirstOrDefault(x => x.id == id);
         return(parentList);
     }
 }
예제 #2
0
        // מחיקה

        public static void DeleteParents(string id)
        {
            using (var context = new PARENTSEntities())
            {
                parents parents = context.parents.Where(p => p.id.Equals(id)).FirstOrDefault();
                context.parents.Remove(parents);
                context.SaveChanges();
            }
        }
예제 #3
0
 //הוספת
 public static string AddParents(parents parents)
 {
     using (var context = new PARENTSEntities())
     {
         parents p = context.parents.Add(parents);
         context.SaveChanges();
         return(p.id);
     }
 }
예제 #4
0
 public static parents GetParentByIdStudent(string id)
 {
     using (var context = new PARENTSEntities())
     {
         studens student    = context.studens.Where(s => s.id == id).FirstOrDefault();
         parents parentList = context.parents.Where(p => p.id == student.id_parent).FirstOrDefault();
         return(parentList);
     }
 }
예제 #5
0
 //עדכון
 public static void UpdateParents(parents parents)
 {
     using (var context = new PARENTSEntities())
     {
         parents p = context.parents.Where(x => x.id == parents.id).FirstOrDefault();
         if (p != null)
         {
             p.id             = parents.id;
             p.first_name     = parents.first_name;
             p.code_instation = parents.code_instation;
             p.email          = parents.email;
             p.last_name      = parents.last_name;
             p.telefone       = parents.telefone;
             context.SaveChanges();
         }
     }
 }