Skip to content

Commit 3505a7f

Browse files
authored
Merge pull request #1019 from TechnologyEnhancedLearning/RC
Merge LH Dahlia changes to master
2 parents 909c5ff + 30b7e00 commit 3505a7f

File tree

84 files changed

+1484
-1264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1484
-1264
lines changed

AdminUI/LearningHub.Nhs.AdminUI/Controllers/RoadmapController.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public async Task<IActionResult> AddUpdate(UpdateViewModel update)
9999
RoadmapTypeId = update.RoadmapTypeId,
100100
};
101101
var roadmapId = await this.roadmapService.AddRoadmap(roadmap);
102-
return this.RedirectToAction("EditUpdate", new { id = roadmapId });
102+
return this.RedirectToAction("Details", new { id = roadmapId });
103103
}
104104

105105
/// <summary>
@@ -160,7 +160,7 @@ public async Task<IActionResult> EditUpdate(UpdateViewModel update)
160160
Id = update.Id,
161161
};
162162
await this.roadmapService.UpdateRoadmap(roadmap);
163-
return this.RedirectToAction("EditUpdate", new { roadmap.Id });
163+
return this.RedirectToAction("Details", new { roadmap.Id });
164164
}
165165

166166
/// <summary>
@@ -202,6 +202,18 @@ public async Task<IActionResult> Updates(string searchTerm = null)
202202
return this.View(model);
203203
}
204204

205+
/// <summary>
206+
/// The Details.
207+
/// </summary>
208+
/// <param name="id">The id<see cref="int"/>.</param>
209+
/// <returns>The <see cref="Task{IActionResult}"/>.</returns>
210+
[HttpGet]
211+
public async Task<IActionResult> Details(int id)
212+
{
213+
var roadmap = await this.roadmapService.GetIdAsync(id);
214+
return this.View(roadmap);
215+
}
216+
205217
/// <summary>
206218
/// The UploadFile.
207219
/// </summary>

AdminUI/LearningHub.Nhs.AdminUI/Interfaces/IRoadmapService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Threading.Tasks;
55
using LearningHub.Nhs.Models.Entities;
6+
using LearningHub.Nhs.Models.RoadMap;
67

78
/// <summary>
89
/// Defines the <see cref="IRoadmapService" />.
@@ -36,6 +37,13 @@ public interface IRoadmapService
3637
/// <returns>The <see cref="List{Roadmap}"/>.</returns>
3738
Task<List<Roadmap>> GetUpdates();
3839

40+
/// <summary>
41+
/// The GetIdAsync.
42+
/// </summary>
43+
/// <param name="id">The id<see cref="int"/>.</param>
44+
/// <returns>The <see cref="Task{Roadmap}"/>.</returns>
45+
Task<RoadMapViewModel> GetIdAsync(int id);
46+
3947
/// <summary>
4048
/// The UpdateRoadmap.
4149
/// </summary>

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
9090
<PackageReference Include="IdentityModel" Version="4.6.0" />
9191
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
92-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
92+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.47" />
9393
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
9494
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.36" />
9595
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.36" />

AdminUI/LearningHub.Nhs.AdminUI/Services/RoadmapService.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading.Tasks;
88
using LearningHub.Nhs.AdminUI.Interfaces;
99
using LearningHub.Nhs.Models.Entities;
10+
using LearningHub.Nhs.Models.RoadMap;
1011
using Newtonsoft.Json;
1112

1213
/// <summary>
@@ -134,6 +135,34 @@ public async Task<List<Roadmap>> GetUpdates()
134135
return viewmodel;
135136
}
136137

138+
/// <summary>
139+
/// The GetIdAsync.
140+
/// </summary>
141+
/// <param name="id">The id<see cref="int"/>.</param>
142+
/// <returns>The <see cref="Task{Roadmap}"/>.</returns>
143+
public async Task<RoadMapViewModel> GetIdAsync(int id)
144+
{
145+
RoadMapViewModel viewmodel = null;
146+
147+
var client = await this.LearningHubHttpClient.GetClientAsync();
148+
var request = $"Roadmap/GetRoadMapsById/{id}";
149+
var response = await client.GetAsync(request).ConfigureAwait(false);
150+
151+
if (response.IsSuccessStatusCode)
152+
{
153+
var result = response.Content.ReadAsStringAsync().Result;
154+
viewmodel = JsonConvert.DeserializeObject<RoadMapViewModel>(result);
155+
}
156+
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized
157+
||
158+
response.StatusCode == System.Net.HttpStatusCode.Forbidden)
159+
{
160+
throw new Exception("AccessDenied");
161+
}
162+
163+
return viewmodel;
164+
}
165+
137166
/// <summary>
138167
/// The UpdateRoadmap.
139168
/// </summary>

0 commit comments

Comments
 (0)