public void Add(Notification notification) { using (var dbContext = new MedialynxDbNotificationsContext()) { dbContext.Notifications.Add(notification); dbContext.SaveChanges(); } }
public void Update(Notification notification) { using (var dbContext = new MedialynxDbNotificationsContext()) { Notification existsNotification = dbContext.Notifications.FirstOrDefault(n => n != null && n.Id == notification.Id); if (existsNotification != null) { if (Utils.CopyPropertyValues <Notification>(notification, existsNotification)) { dbContext.Notifications.Update(existsNotification); dbContext.SaveChanges(); } } } }