public void Handle(AgreementToCreateNotificationSent @event) { using (var context = new ProjectionContext(ConnectionString.Get())) { var entity = context.Notifications.FirstOrDefault(a => a.Id == @event.NotificationId); if (entity == null) { entity = new NotificationSqlEntity(); context.Notifications.Add(entity); } entity.Id = @event.NotificationId; entity.SessionId = @event.SessionId; entity.CompanyId = @event.CompanyId; entity.ReminderType = NotificationType.AgreementToCreate; entity.AffectedRole = UserRole.Operator; entity.Label = "Convention(s) à créer"; context.SaveChanges(); } }
public void Handle(SeatToDefineStudentNotificationSent @event) { using (var context = new ProjectionContext(ConnectionString.Get())) { var entity = context.Notifications.FirstOrDefault(a => a.Id == @event.NotificationId); if (entity == null) { entity = new NotificationSqlEntity(); context.Notifications.Add(entity); } entity.Id = @event.NotificationId; entity.SeatId = @event.SeatId; entity.SessionId = @event.SessionId; entity.CompanyId = @event.CompanyId; entity.Label = "Stagiaire(s) à définir"; entity.AffectedRole = UserRole.Manager; entity.ReminderType = NotificationType.StudentToDefine; context.SaveChanges(); } }