public Task <SubscribeEventInfo> CreateSubscribeEventInfoAsync(SubscribeEventInfo newSubscribeEventInfoEventInfo) { if (newSubscribeEventInfoEventInfo == null) { throw new ArgumentNullException(); } subscribeEventInfo.InsertOne(newSubscribeEventInfoEventInfo); return(Task.FromResult(newSubscribeEventInfoEventInfo)); }
public Task UpdateAsync(SubscribeEventInfo entry) { var subscribeEventInfo = new SubscribeEventInfo() { Id = entry.Id, FirstName = entry.FirstName, LastName = entry.LastName, Email = entry.Email, Title = entry.Title, Description = entry.Description, CreatedAt = entry.CreatedAt, IsChecked = true }; this.subscribeEventInfo.ReplaceOne(info => info.Id == entry.Id, subscribeEventInfo); return(Task.CompletedTask); }
public async void GenerateEventOfSubscription() { var dateOfLastCheckedEntry = await settingsRepository.GetLastSubscribeSettings(); var entries = await entryRepository.GetAllAsync(); foreach (var entry in entries) { if (dateOfLastCheckedEntry == null || entry.CreatedAt.CompareTo(dateOfLastCheckedEntry.CreatedAt) > 0) { var userByEntry = await userRepository.GetByIdAsync(entry.UserId); var activity = await activityRepository.GetByIdAsync(entry.ActivityId); var maraphone = await maraphoneRepository.GetAsync(activity.MaraphoneId, cancellationToken : CancellationToken.None); var subscribeEventInfo = new SubscribeEventInfo() { FirstName = userByEntry.FirstName, LastName = userByEntry.LastName, Email = userByEntry.Email, CreatedAt = entry.CreatedAt, Title = maraphone.Title, Description = maraphone.Description, IsChecked = false }; await subscribeEventInfoRepository.CreateSubscribeEventInfoAsync(subscribeEventInfo); } } var settingOfEventSubscribe = new SettingsEventOfSubscribeToActivity() { CreatedAt = DateTime.Now }; await settingsRepository.CreateSubscribeToActivitySettings(settingOfEventSubscribe); }