public async void GenerateEventForUnRegistrationUser() { var dateOfLastCheckedRegistrationUser = await settingsRepository.GetLastRegistrationSettings(); var users = await userRepository.GetAllAsync(); foreach (var user in users) { if (dateOfLastCheckedRegistrationUser == null || user.RegisteredAt.CompareTo(dateOfLastCheckedRegistrationUser.DateOfLastNotificationUser) > 0) { var registrationEventInfo = new RegistrationEventInfo() { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName, RegisteredAt = user.RegisteredAt, IsChecked = false }; await registrationEventInfoRepository.CreateRegistrationEventInfoAsync(registrationEventInfo); var settingOfEventsRegistration = new SettingsEventOfRegistration() { DateOfLastNotificationUser = user.RegisteredAt }; await settingsRepository.CreateRegistrationEventSettingsAsync(settingOfEventsRegistration); } } }
public Task <RegistrationEventInfo> CreateRegistrationEventInfoAsync( RegistrationEventInfo newRegistrationEventInfo) { if (newRegistrationEventInfo == null) { throw new ArgumentNullException(); } registrationEventInfo.InsertOne(newRegistrationEventInfo); return(Task.FromResult(newRegistrationEventInfo)); }
public Task UpdateAsync(RegistrationEventInfo user) { var newRegestrationEventInfo = new RegistrationEventInfo() { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, RegisteredAt = user.RegisteredAt, IsChecked = true }; this.registrationEventInfo.ReplaceOne(info => info.Id == user.Id, newRegestrationEventInfo); return(Task.CompletedTask); }