Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LearningHub.Nhs.WebUI/Controllers/Api/ScormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private async Task<bool> Finish(SCO scoObject)
try
{
// Check that SCO content is active
var activeContentList = this.userService.GetActiveContentAsync().Result;
var activeContentList = await this.userService.GetActiveContentAsync();
var activeContent = activeContentList.FirstOrDefault(ac => ac.ScormActivityId == scoObject.InstanceId);

if (activeContent == null)
Expand Down Expand Up @@ -229,7 +229,7 @@ private async Task<bool> Commit(SCO scoObject)
{
try
{
var activeContent = this.userService.GetActiveContentAsync().Result;
var activeContent = await this.userService.GetActiveContentAsync();
if (!activeContent.Any(ac => ac.ScormActivityId == scoObject.InstanceId))
{
throw new Exception($"User does not have ActiveContent for ScormActivityId={scoObject.InstanceId}");
Expand Down
8 changes: 4 additions & 4 deletions LearningHub.Nhs.WebUI/Helpers/LearningHubApiFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<T> GetAsync<T>(string url)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
vm = JsonConvert.DeserializeObject<T>(result);

return vm;
Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task<ApiResponse> PostAsync<T, TBody>(string url, TBody body)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down Expand Up @@ -157,7 +157,7 @@ public async Task<ApiResponse> PutAsync(string url)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down Expand Up @@ -206,7 +206,7 @@ public async Task<ApiResponse> PutAsync<T>(string url, T body)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down
8 changes: 4 additions & 4 deletions LearningHub.Nhs.WebUI/Helpers/OpenApiFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<T> GetAsync<T>(string url)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
vm = JsonConvert.DeserializeObject<T>(result);

return vm;
Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task<ApiResponse> PostAsync<T, TBody>(string url, TBody body)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down Expand Up @@ -157,7 +157,7 @@ public async Task<ApiResponse> PutAsync(string url)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down Expand Up @@ -206,7 +206,7 @@ public async Task<ApiResponse> PutAsync<T>(string url, T body)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.Success)
{
Expand Down
18 changes: 9 additions & 9 deletions LearningHub.Nhs.WebUI/Services/ActivityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<LearningHubValidationResult> CreateAssessmentResourceActivityA

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);

if (!apiResponse.Success)
Expand Down Expand Up @@ -82,7 +82,7 @@ public async Task<AssessmentViewModel> CreateAssessmentResourceActivityInteracti

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewModel = JsonConvert.DeserializeObject<AssessmentViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task<LearningHubValidationResult> CreateMediaResourceActivityAsync(

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);

if (!apiResponse.Success)
Expand Down Expand Up @@ -147,7 +147,7 @@ public async Task<LearningHubValidationResult> CreateMediaResourceActivityIntera

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);

if (!apiResponse.Success)
Expand Down Expand Up @@ -182,7 +182,7 @@ public async Task<LearningHubValidationResult> CreateResourceActivityAsync(Creat

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);

if (!apiResponse.Success)
Expand Down Expand Up @@ -215,7 +215,7 @@ public async Task<ScormActivityViewModel> LaunchScormActivityAsync(LaunchScormAc

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<ScormActivityViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
Expand Down Expand Up @@ -245,7 +245,7 @@ public async Task<ScormUpdateResponseViewModel> UpdateScormActivityAsync(ScormAc

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
updateResponse = JsonConvert.DeserializeObject<ScormUpdateResponseViewModel>(result);

if (!updateResponse.IsValid)
Expand Down Expand Up @@ -279,7 +279,7 @@ public async Task<LearningHubValidationResult> CompleteScormActivity(ScormActivi
LearningHubValidationResult validationResult;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
validationResult = JsonConvert.DeserializeObject<LearningHubValidationResult>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
Expand Down Expand Up @@ -330,7 +330,7 @@ public async Task<bool> CheckSuspendDataToBeCleared(int lastScormActivityId, int

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<bool>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
Expand Down
8 changes: 4 additions & 4 deletions LearningHub.Nhs.WebUI/Services/BoomarkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<int> Create(UserBookmarkViewModel bookmarkViewModel)
var bookmarkId = bookmarkViewModel.Id;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
bookmarkId = Convert.ToInt32(result);
}

Expand Down Expand Up @@ -75,7 +75,7 @@ public async Task<int> Edit(UserBookmarkViewModel bookmarkViewModel)
var bookmarkId = bookmarkViewModel.Id;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
bookmarkId = Convert.ToInt32(result);
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public async Task<IEnumerable<UserBookmarkViewModel>> GetAllByParent(int? parent

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<IEnumerable<UserBookmarkViewModel>>(result);
}

Expand Down Expand Up @@ -139,7 +139,7 @@ public async Task<int> Toggle(UserBookmarkViewModel bookmarkViewModel)
var bookmarkId = bookmarkViewModel.Id;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
bookmarkId = Convert.ToInt32(result);
}

Expand Down
8 changes: 4 additions & 4 deletions LearningHub.Nhs.WebUI/Services/CardService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task<MyContributionsTotalsViewModel> GetMyContributionsTotalsAsync(

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
totals = JsonConvert.DeserializeObject<MyContributionsTotalsViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -74,7 +74,7 @@ public async Task<List<ContributedResourceCardViewModel>> GetContributionsAsync(

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
myContributionCards = JsonConvert.DeserializeObject<List<ContributedResourceCardViewModel>>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task<MyResourceViewModel> GetMyResourceViewModelAsync()

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
myresourcecards = JsonConvert.DeserializeObject<MyResourceViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -131,7 +131,7 @@ public async Task<ResourceCardExtendedViewModel> GetResourceCardExtendedViewMode

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
resourceCardExtendedViewModel = JsonConvert.DeserializeObject<ResourceCardExtendedViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down
22 changes: 11 additions & 11 deletions LearningHub.Nhs.WebUI/Services/CatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<List<CatalogueBasicViewModel>> GetCataloguesForUserAsync()

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<List<CatalogueBasicViewModel>>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -78,7 +78,7 @@ public async Task<CatalogueViewModel> GetCatalogueAsync(string reference)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<CatalogueViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down Expand Up @@ -106,7 +106,7 @@ public async Task<CatalogueViewModel> GetCatalogueAsync(int catalogueNodeVersion

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<CatalogueViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down Expand Up @@ -134,7 +134,7 @@ public async Task<CatalogueViewModel> GetCatalogueRecordedAsync(string reference

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<CatalogueViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down Expand Up @@ -165,7 +165,7 @@ public async Task<CatalogueResourceResponseViewModel> GetResourcesAsync(Catalogu

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<CatalogueResourceResponseViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down Expand Up @@ -352,7 +352,7 @@ public async Task<List<RestrictedCatalogueAccessRequestViewModel>> GetRestricted

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewModel = JsonConvert.DeserializeObject<List<RestrictedCatalogueAccessRequestViewModel>>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -385,7 +385,7 @@ public async Task<RestrictedCatalogueSummaryViewModel> GetRestrictedCatalogueSum

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<RestrictedCatalogueSummaryViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down Expand Up @@ -420,7 +420,7 @@ public async Task<RestrictedCatalogueUsersViewModel> GetRestrictedCatalogueUsers

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewModel = JsonConvert.DeserializeObject<RestrictedCatalogueUsersViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand Down Expand Up @@ -579,7 +579,7 @@ public async Task<LearningHubValidationResult> RemoveUserFromRestrictedAccessUse
ApiResponse apiResponse = null;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);

if (!apiResponse.Success)
Expand All @@ -593,7 +593,7 @@ public async Task<LearningHubValidationResult> RemoveUserFromRestrictedAccessUse
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
apiResponse = JsonConvert.DeserializeObject<ApiResponse>(result);
if (apiResponse.ValidationResult == null)
{
Expand All @@ -619,7 +619,7 @@ public async Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string fil

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<AllCatalogueResponseViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
Expand Down
4 changes: 2 additions & 2 deletions LearningHub.Nhs.WebUI/Services/ContentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task<PageViewModel> GetPageByIdAsync(int id, bool preview)

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<PageViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
Expand All @@ -70,7 +70,7 @@ public async Task<PageSectionDetailViewModel> GetPageSectionDetailVideoAssetById

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
var result = await response.Content.ReadAsStringAsync();
viewmodel = JsonConvert.DeserializeObject<PageSectionDetailViewModel>(result);
if (viewmodel?.VideoAsset?.AzureMediaAssetId > 0)
{
Expand Down
Loading
Loading