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); } }
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(); } }
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; } } }
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); } }