public BaseRS Add(ScheduleMessage messageToBeSchedule) { BaseRS result = new BaseRS(); _scheduleMessageList.Add(messageToBeSchedule); result.Success = true; return result; }
public async Task<BaseRS> Process() { BaseRS result = new BaseRS(); List<ScheduleMessage> messagesToBeSendList = _repository.GetAllMessagesToSend(); List<Task<string>> taskList = new List<Task<string>>(); foreach (var message in messagesToBeSendList) { taskList.Add(PrepareTask(message)); } var continuation = Task.WhenAll(taskList); continuation.Wait(); if (continuation.Status == TaskStatus.RanToCompletion) { result.Success = true; } return result; }