We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ccfe6e commit e39319aCopy full SHA for e39319a
Auth/LearningHub.Nhs.Auth/Services/MoodleApiService.cs
@@ -44,11 +44,14 @@ public async Task<int> GetMoodleUserIdByUsernameAsync(int currentUserId)
44
var result = response.Content.ReadAsStringAsync().Result;
45
var viewmodel = JsonConvert.DeserializeObject<MoodleUserResponseViewModel>(result);
46
47
- foreach (var user in viewmodel.Users)
+ if (viewmodel?.Users != null)
48
{
49
- if (user.Username == currentUserId.ToString())
+ foreach (var user in viewmodel.Users)
50
51
- moodleUserId = user.Id;
+ if (user.Username == currentUserId.ToString())
52
+ {
53
+ moodleUserId = user.Id;
54
+ }
55
}
56
57
0 commit comments