Beispiel #1
0
 public Couple FindByIDCouple(int id)
 {
     using (db_schedule db = new db_schedule())
     {
         Couple couple = db.Couple
                         .Where(s => s.ID_Couple == id)
                         .FirstOrDefault();
         return(couple);
     }
 }
Beispiel #2
0
 public void DeleteCouple(int id)
 {
     using (db_schedule db = new db_schedule())
     {
         Couple couple = db.Couple
                         .Where(s => s.ID_Couple == id)
                         .FirstOrDefault();
         db.Couple.Remove(couple);
         db.SaveChanges();
     }
 }
Beispiel #3
0
 public void UpdateCouple(Couple couple)
 {
     if (couple.Start != null && couple.End != null)
     {
         using (db_schedule db = new db_schedule())
         {
             Couple c = db.Couple
                        .Where(s => s.ID_Couple == couple.ID_Couple)
                        .FirstOrDefault();
             c.Start = couple.Start;
             c.End   = couple.End;
         }
     }
 }
Beispiel #4
0
 public Couple AddCouple(Couple couple)
 {
     if (couple.Start != null && couple.End != null)
     {
         using (db_schedule db = new db_schedule())
         {
             db.Couple.Add(couple);
             db.SaveChanges();
             return(couple);
         }
     }
     else
     {
         return(couple);
     }
 }