public void AddNotificare(int id_cerere, int id_pacient) { using (UnitOfWork unitOfWork = new UnitOfWork()) { Notificari notificare = new Notificari(id_cerere, id_pacient); unitOfWork.NotificariRepo.Save(notificare); unitOfWork.Save(); } }
private static void InitializeNotificari(CTContext context) { if (context.Notificari.Any()) { return; } Notificari n1 = new Notificari(2, 1); Notificari n2 = new Notificari(1, 2); Notificari n3 = new Notificari(1, 1); Notificari n4 = new Notificari(3, 2); var notificari = new Notificari[] { n1, n2, n3, n4 }; foreach (Notificari n in notificari) { context.Notificari.Add(n); } context.SaveChanges(); }