Skip to content

Commit da7b952

Browse files
authored
Merge pull request #408 from TechnologyEnhancedLearning/releases/LHTelescopium
Merge Releases/lh telescopium changes to Test Env
2 parents f8ff710 + 562d01d commit da7b952

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

WebAPI/LearningHub.Nhs.API/Controllers/ResourceController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,9 @@ public async Task<ActionResult> GetScormDetailsAsync(int resourceVersionId)
496496
/// <param name="resourceVersionId">The resourceVersionId<see cref="int"/>.</param>
497497
/// <returns>The <see cref="Task{ActionResult}"/>.</returns>
498498
[HttpGet("GetExternalContentDetailsById/{resourceVersionId}")]
499-
public ActionResult GetScormContentDetailsById(int resourceVersionId)
499+
public async Task<ActionResult> GetScormContentDetailsById(int resourceVersionId)
500500
{
501-
return this.Ok(this.resourceService.GetExternalContentDetails(resourceVersionId, this.CurrentUserId));
501+
return this.Ok(await this.resourceService.GetExternalContentDetails(resourceVersionId, this.CurrentUserId));
502502
}
503503

504504
/// <summary>

WebAPI/LearningHub.Nhs.Repository.Interface/Resources/IResourceVersionRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,6 @@ public interface IResourceVersionRepository : IGenericRepository<ResourceVersion
262262
/// <param name="resourceVersionId">resourceVersionId.</param>
263263
/// <param name="userId">userId.</param>
264264
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
265-
ExternalContentDetailsViewModel GetExternalContentDetails(int resourceVersionId, int userId);
265+
Task<ExternalContentDetailsViewModel> GetExternalContentDetails(int resourceVersionId, int userId);
266266
}
267267
}

WebAPI/LearningHub.Nhs.Repository/Resources/ResourceVersionRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,15 @@ await this.DbContext.Database.ExecuteSqlRawAsync(
679679
/// <param name="resourceVersionId">resourceVersionId.</param>
680680
/// <param name="userId">userId.</param>
681681
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
682-
public ExternalContentDetailsViewModel GetExternalContentDetails(int resourceVersionId, int userId)
682+
public async Task<ExternalContentDetailsViewModel> GetExternalContentDetails(int resourceVersionId, int userId)
683683
{
684684
try
685685
{
686686
var param0 = new SqlParameter("@resourceVersionId", SqlDbType.Int) { Value = resourceVersionId };
687687
var param1 = new SqlParameter("@userId", SqlDbType.Int) { Value = userId };
688688

689-
var externalContentDetailsViewModel = this.DbContext.ExternalContentDetailsViewModel.FromSqlRaw("[resources].[GetExternalContentDetails] @resourceVersionId, @userId", param0, param1).AsEnumerable().FirstOrDefault();
690-
689+
var retVal = await this.DbContext.ExternalContentDetailsViewModel.FromSqlRaw("[resources].[GetExternalContentDetails] @resourceVersionId, @userId", param0, param1).AsNoTracking().ToListAsync();
690+
ExternalContentDetailsViewModel externalContentDetailsViewModel = retVal.AsEnumerable().FirstOrDefault();
691691
return externalContentDetailsViewModel;
692692
}
693693
catch (Exception ex)

WebAPI/LearningHub.Nhs.Services.Interface/IResourceService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public interface IResourceService
104104
/// <param name="resourceVersionId">The resourceVersionId<see cref="int"/>.</param>
105105
/// <param name="userId">userId.</param>
106106
/// <returns>The <see cref="Task{ScormContentDetailsViewModel}"/>.</returns>
107-
ExternalContentDetailsViewModel GetExternalContentDetails(int resourceVersionId, int userId);
107+
Task<ExternalContentDetailsViewModel> GetExternalContentDetails(int resourceVersionId, int userId);
108108

109109
/// <summary>
110110
/// The get image details by id async.

WebAPI/LearningHub.Nhs.Services/ResourceService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ public async Task<GenericFileViewModel> GetGenericFileDetailsByIdAsync(int resou
27932793
var vm = this.mapper.Map<GenericFileViewModel>(genericFile);
27942794

27952795
// User id is used to populate a field we aren't going to use, so we can just pass in the system user id.
2796-
var externalContentDetails = this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
2796+
var externalContentDetails = await this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
27972797
if (!string.IsNullOrEmpty(externalContentDetails?.ExternalReference))
27982798
{
27992799
vm.HostedContentUrl = $"{this.settings.LearningHubContentServerUrl}/{externalContentDetails.ExternalReference}/".ToLower();
@@ -2814,7 +2814,7 @@ public async Task<HtmlResourceViewModel> GetHtmlDetailsByIdAsync(int resourceVer
28142814
var vm = this.mapper.Map<HtmlResourceViewModel>(htmlFile);
28152815

28162816
// User id is used to populate a field we aren't going to use, so we can just pass in the system user id.
2817-
var externalContentDetails = this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
2817+
var externalContentDetails = await this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
28182818
if (!string.IsNullOrEmpty(externalContentDetails?.ExternalReference))
28192819
{
28202820
vm.HostedContentUrl = $"{this.settings.LearningHubContentServerUrl}/{externalContentDetails.ExternalReference}/".ToLower();
@@ -2835,7 +2835,7 @@ public async Task<ScormViewModel> GetScormDetailsByIdAsync(int resourceVersionId
28352835
var vm = this.mapper.Map<ScormViewModel>(scorm);
28362836

28372837
// User id is used to populate a field we aren't going to use, so we can just pass in the system user id.
2838-
var externalContentDetails = this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
2838+
var externalContentDetails = await this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, 4);
28392839
if (!string.IsNullOrEmpty(externalContentDetails?.ExternalReference))
28402840
{
28412841
vm.HostedContentUrl = $"{this.settings.LearningHubContentServerUrl}/{externalContentDetails.ExternalReference}/".ToLower();
@@ -2851,9 +2851,9 @@ public async Task<ScormViewModel> GetScormDetailsByIdAsync(int resourceVersionId
28512851
/// <param name="resourceVersionId">The resourceVersionId<see cref="int"/>.</param>
28522852
/// <param name="userId">userId.</param>
28532853
/// <returns>The <see cref="Task{ExternalContentDetailsViewModel}"/>.</returns>
2854-
public ExternalContentDetailsViewModel GetExternalContentDetails(int resourceVersionId, int userId)
2854+
public async Task<ExternalContentDetailsViewModel> GetExternalContentDetails(int resourceVersionId, int userId)
28552855
{
2856-
var viewModel = this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, userId);
2856+
var viewModel = await this.resourceVersionRepository.GetExternalContentDetails(resourceVersionId, userId);
28572857
if (viewModel != null)
28582858
{
28592859
viewModel.HostedContentUrl = $"{this.settings.LearningHubContentServerUrl}/{viewModel.ExternalReference}/".ToLower();

0 commit comments

Comments
 (0)