/// <inheritdoc /> Task <IDictionaryRange <int, ObjectiveName> > IRepository <int, ObjectiveName> .FindAllAsync(CancellationToken cancellationToken) { IObjectiveNameRepository self = this; var request = new ObjectiveNameRequest { Culture = self.Culture }; return(this.serviceClient.SendAsync <ICollection <ObjectiveNameDataContract> >(request, cancellationToken).ContinueWith <IDictionaryRange <int, ObjectiveName> >(task => { var response = task.Result; if (response.Content == null) { return new DictionaryRange <int, ObjectiveName>(0); } var values = response.Content.Select(value => this.converterForObjectiveName.Convert(value, null)).ToList(); var objectiveNames = new DictionaryRange <int, ObjectiveName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var objectiveName in values) { objectiveName.Culture = request.Culture; objectiveNames.Add(objectiveName.ObjectiveId, objectiveName); } return objectiveNames; }, cancellationToken)); }
/// <inheritdoc /> IDictionaryRange <int, ObjectiveName> IRepository <int, ObjectiveName> .FindAll() { IObjectiveNameRepository self = this; var request = new ObjectiveNameRequest { Culture = self.Culture }; var response = this.serviceClient.Send <ICollection <ObjectiveNameDataContract> >(request); if (response.Content == null) { return(new DictionaryRange <int, ObjectiveName>(0)); } var values = response.Content.Select(value => this.converterForObjectiveName.Convert(value, null)).ToList(); var objectiveNames = new DictionaryRange <int, ObjectiveName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var objectiveName in values) { objectiveName.Culture = request.Culture; objectiveNames.Add(objectiveName.ObjectiveId, objectiveName); } return(objectiveNames); }
/// <inheritdoc /> async Task <IDictionaryRange <int, ObjectiveName> > IRepository <int, ObjectiveName> .FindAllAsync(CancellationToken cancellationToken) { IObjectiveNameRepository self = this; var request = new ObjectiveNameRequest { Culture = self.Culture }; var response = await this.serviceClient.SendAsync <ICollection <ObjectiveNameDTO> >(request, cancellationToken).ConfigureAwait(false); if (response.Content == null) { return(new DictionaryRange <int, ObjectiveName>(0)); } var values = response.Content.Select(value => this.objectiveNameConverter.Convert(value, null)).ToList(); var objectiveNames = new DictionaryRange <int, ObjectiveName>(values.Count) { SubtotalCount = values.Count, TotalCount = values.Count }; foreach (var objectiveName in values) { objectiveName.Culture = request.Culture; objectiveNames.Add(objectiveName.ObjectiveId, objectiveName); } return(objectiveNames); }