public void AddNotificationPreference(NotificationPreferenceDto notificationPreference) { Log.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + "() traced. Added Notification Preference for: " + notificationPreference.EmployeeId); var notificationsRepository = new NotificationsRepository(); notificationsRepository.AddNotificationPreference(notificationPreference); }
public CreateModel(ApplicationDbContext context, NotificationsRepository notificationsRepo, IMapper mapper) { _context = context; _notificationsRepo = notificationsRepo; _mapper = mapper; }
public CreateModel(ApplicationDbContext context, ImageUploader uploader, OgmaConfig config, NotificationsRepository notificationsRepo, IMapper mapper) { _context = context; _uploader = uploader; _config = config; _notificationsRepo = notificationsRepo; _mapper = mapper; }
public void Delete_By_Entity() { var provider = ScopeProvider; using (var scope = provider.CreateScope()) { var repo = new NotificationsRepository((IScopeAccessor)provider); var node1 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; ScopeAccessor.AmbientScope.Database.Insert(node1); var entity1 = Mock.Of <IEntity>(e => e.Id == node1.NodeId); var node2 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; ScopeAccessor.AmbientScope.Database.Insert(node2); var entity2 = Mock.Of <IEntity>(e => e.Id == node2.NodeId); for (var i = 0; i < 10; i++) { var userDto = new UserDto { Email = "test" + i, Login = "******" + i, Password = "******", UserName = "******" + i, UserLanguage = "en", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }; ScopeAccessor.AmbientScope.Database.Insert(userDto); var userNew = Mock.Of <IUser>(e => e.Id == userDto.Id); var notification = repo.CreateNotification(userNew, i % 2 == 0 ? entity1 : entity2, i.ToString(CultureInfo.InvariantCulture)); } var delCount = repo.DeleteNotifications(entity1); Assert.AreEqual(5, delCount); } }