diff --git a/LearningHub.Nhs.WebUI/Services/MoodleHttpClient.cs b/LearningHub.Nhs.WebUI/Services/MoodleHttpClient.cs index 9ffe8a8fd..79f44027a 100644 --- a/LearningHub.Nhs.WebUI/Services/MoodleHttpClient.cs +++ b/LearningHub.Nhs.WebUI/Services/MoodleHttpClient.cs @@ -26,7 +26,7 @@ public class MoodleHttpClient : IMoodleHttpClient, IDisposable public MoodleHttpClient(HttpClient httpClient, IConfiguration config) { this.httpClient = httpClient; - this.moodleAPIBaseUrl = config["MoodleAPIConfig:BaseUrl"]; + this.moodleAPIBaseUrl = config["MoodleAPIConfig:BaseUrl"] + "webservice/rest/server.php"; this.moodleAPIMoodleWSRestFormat = config["MoodleAPIConfig:MoodleWSRestFormat"]; this.moodleAPIWSToken = config["MoodleAPIConfig:WSToken"]; } diff --git a/LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml b/LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml index 3be1c1b09..058c39165 100644 --- a/LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml @@ -2,15 +2,17 @@ @using LearningHub.Nhs.WebUI.Extensions @using LearningHub.Nhs.WebUI.Helpers @model MoodleCourseResponseViewModel +@inject Microsoft.Extensions.Configuration.IConfiguration Configuration; + @{ bool providerExists = false; string cardStyle = "card-provider-details--blank"; - string GetUrl(int courseId) + string GetMoodleCourseUrl(int courseId) { - string host = $"http://localhost"; + var apiBaseUrl = Configuration["MoodleAPIConfig:BaseUrl"]; string path = $"course/view.php"; - string returnUrl = $@"{host}/{path}?id={courseId}"; + string returnUrl = $@"{apiBaseUrl}/{path}?id={courseId}"; return returnUrl; } @@ -47,7 +49,7 @@

- @Model.DisplayName + @Model.DisplayName