diff --git a/Auth/LearningHub.Nhs.Auth.Tests/LearningHub.Nhs.Auth.Tests.csproj b/Auth/LearningHub.Nhs.Auth.Tests/LearningHub.Nhs.Auth.Tests.csproj index ec6d6ad..d5df667 100644 --- a/Auth/LearningHub.Nhs.Auth.Tests/LearningHub.Nhs.Auth.Tests.csproj +++ b/Auth/LearningHub.Nhs.Auth.Tests/LearningHub.Nhs.Auth.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj b/Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj index 2933aee..d2cf97a 100644 --- a/Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj +++ b/Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj @@ -101,7 +101,7 @@ - + diff --git a/LearningHub.Nhs.UserApi.Repository.Interface/LearningHub.Nhs.UserApi.Repository.Interface.csproj b/LearningHub.Nhs.UserApi.Repository.Interface/LearningHub.Nhs.UserApi.Repository.Interface.csproj index 29a3a90..90e9ad6 100644 --- a/LearningHub.Nhs.UserApi.Repository.Interface/LearningHub.Nhs.UserApi.Repository.Interface.csproj +++ b/LearningHub.Nhs.UserApi.Repository.Interface/LearningHub.Nhs.UserApi.Repository.Interface.csproj @@ -8,7 +8,7 @@ - + all diff --git a/LearningHub.Nhs.UserApi.Repository/LearningHub.Nhs.UserApi.Repository.csproj b/LearningHub.Nhs.UserApi.Repository/LearningHub.Nhs.UserApi.Repository.csproj index 5921669..4abd4a0 100644 --- a/LearningHub.Nhs.UserApi.Repository/LearningHub.Nhs.UserApi.Repository.csproj +++ b/LearningHub.Nhs.UserApi.Repository/LearningHub.Nhs.UserApi.Repository.csproj @@ -8,7 +8,7 @@ - + diff --git a/LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs b/LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs index 8b950f7..9da2394 100644 --- a/LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs +++ b/LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs @@ -39,5 +39,21 @@ public interface ICountryService /// The . /// Task> GetFilteredAsync(string filter); + + /// + /// The get all. + /// + /// + /// The . + /// + Task> GetAllUKCountries(); + + /// + /// The get all. + /// + /// + /// The . + /// + Task> GetAllNonUKCountries(); } } \ No newline at end of file diff --git a/LearningHub.Nhs.UserApi.Services.Interface/IElfhUserService.cs b/LearningHub.Nhs.UserApi.Services.Interface/IElfhUserService.cs index 9f77a64..ae510eb 100644 --- a/LearningHub.Nhs.UserApi.Services.Interface/IElfhUserService.cs +++ b/LearningHub.Nhs.UserApi.Services.Interface/IElfhUserService.cs @@ -520,5 +520,13 @@ public interface IElfhUserService /// currentUserId. /// The . Task CheckSamePrimaryemailIsPendingToValidate(string secondaryEmail, int currentUserId); + + /// + /// Update MyAccount Personal Details. + /// + /// personalDetailsViewModel. + /// currentUserId. + /// The . + Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId); } } \ No newline at end of file diff --git a/LearningHub.Nhs.UserApi.Services.Interface/LearningHub.Nhs.UserAPI.Services.Interface.csproj b/LearningHub.Nhs.UserApi.Services.Interface/LearningHub.Nhs.UserAPI.Services.Interface.csproj index 29a3a90..90e9ad6 100644 --- a/LearningHub.Nhs.UserApi.Services.Interface/LearningHub.Nhs.UserAPI.Services.Interface.csproj +++ b/LearningHub.Nhs.UserApi.Services.Interface/LearningHub.Nhs.UserAPI.Services.Interface.csproj @@ -8,7 +8,7 @@ - + all diff --git a/LearningHub.Nhs.UserApi.Services.UnitTests/LearningHub.Nhs.UserApi.Services.UnitTests.csproj b/LearningHub.Nhs.UserApi.Services.UnitTests/LearningHub.Nhs.UserApi.Services.UnitTests.csproj index a61a661..a090e17 100644 --- a/LearningHub.Nhs.UserApi.Services.UnitTests/LearningHub.Nhs.UserApi.Services.UnitTests.csproj +++ b/LearningHub.Nhs.UserApi.Services.UnitTests/LearningHub.Nhs.UserApi.Services.UnitTests.csproj @@ -10,7 +10,7 @@ - + diff --git a/LearningHub.Nhs.UserApi.Services/CountryService.cs b/LearningHub.Nhs.UserApi.Services/CountryService.cs index 5e2eb60..27d290b 100644 --- a/LearningHub.Nhs.UserApi.Services/CountryService.cs +++ b/LearningHub.Nhs.UserApi.Services/CountryService.cs @@ -79,5 +79,35 @@ public async Task> GetFilteredAsync(string filter) return countryList; } + + /// + /// Get All UK Countries. + /// + /// List of countries. + public async Task> GetAllUKCountries() + { + var items = this.countryRepository.GetAll() + .Where(c => c.Deleted == false && c.Numeric == "826") + .OrderBy(r => r.DisplayOrder); + + var countryList = await this.mapper.ProjectTo(items).ToListWithNoLockAsync(); + + return countryList; + } + + /// + /// Get All Non UK Countries. + /// + /// List of countries. + public async Task> GetAllNonUKCountries() + { + var items = this.countryRepository.GetAll() + .Where(c => c.Deleted == false && c.Numeric != "826") + .OrderBy(r => r.DisplayOrder); + + var countryList = await this.mapper.ProjectTo(items).ToListWithNoLockAsync(); + + return countryList; + } } } diff --git a/LearningHub.Nhs.UserApi.Services/ElfhUserService.cs b/LearningHub.Nhs.UserApi.Services/ElfhUserService.cs index 1e42f93..624c545 100644 --- a/LearningHub.Nhs.UserApi.Services/ElfhUserService.cs +++ b/LearningHub.Nhs.UserApi.Services/ElfhUserService.cs @@ -968,6 +968,26 @@ public async Task CheckSamePrimaryemailIsPendingToValidate(string secondar return false; } + /// + /// Update MyAccount PersonalDetails. + /// + /// personalDetailsViewModel. + /// currentUserId. + /// The . + public async Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId) + { + User user = await this.elfhUserRepository.GetByIdAsync(personalDetailsViewModel.UserId); + user.FirstName = personalDetailsViewModel.FirstName; + user.LastName = personalDetailsViewModel.LastName; + user.PreferredName = personalDetailsViewModel.PreferredName; + if (!string.IsNullOrEmpty(personalDetailsViewModel.SecondaryEmailAddress)) + { + user.AltEmailAddress = personalDetailsViewModel.SecondaryEmailAddress; + } + + await this.elfhUserRepository.UpdateAsync(currentUserId, user); + } + private async Task ValidateAsync(CreateOpenAthensLinkToLhUser newUserDetails) { var registrationValidator = new CreateLinkedOpenAthensUserValidator(); diff --git a/LearningHub.Nhs.UserApi.Services/LearningHub.Nhs.UserApi.Services.csproj b/LearningHub.Nhs.UserApi.Services/LearningHub.Nhs.UserApi.Services.csproj index 670491b..ef123db 100644 --- a/LearningHub.Nhs.UserApi.Services/LearningHub.Nhs.UserApi.Services.csproj +++ b/LearningHub.Nhs.UserApi.Services/LearningHub.Nhs.UserApi.Services.csproj @@ -8,7 +8,7 @@ - + diff --git a/LearningHub.Nhs.UserApi.Shared/LearningHub.Nhs.UserApi.Shared.csproj b/LearningHub.Nhs.UserApi.Shared/LearningHub.Nhs.UserApi.Shared.csproj index ecfe311..f5f2819 100644 --- a/LearningHub.Nhs.UserApi.Shared/LearningHub.Nhs.UserApi.Shared.csproj +++ b/LearningHub.Nhs.UserApi.Shared/LearningHub.Nhs.UserApi.Shared.csproj @@ -8,7 +8,7 @@ - + all diff --git a/LearningHub.Nhs.UserApi.UnitTests/LearningHub.Nhs.UserApi.UnitTests.csproj b/LearningHub.Nhs.UserApi.UnitTests/LearningHub.Nhs.UserApi.UnitTests.csproj index 5c215c5..9993831 100644 --- a/LearningHub.Nhs.UserApi.UnitTests/LearningHub.Nhs.UserApi.UnitTests.csproj +++ b/LearningHub.Nhs.UserApi.UnitTests/LearningHub.Nhs.UserApi.UnitTests.csproj @@ -10,7 +10,7 @@ - + diff --git a/LearningHub.Nhs.UserApi/Controllers/CountryController.cs b/LearningHub.Nhs.UserApi/Controllers/CountryController.cs index e2430d5..8af9d92 100644 --- a/LearningHub.Nhs.UserApi/Controllers/CountryController.cs +++ b/LearningHub.Nhs.UserApi/Controllers/CountryController.cs @@ -83,5 +83,33 @@ public async Task GetFiltered(string filter) var list = await this.countryService.GetFilteredAsync(filter); return this.Ok(list); } + + /// + /// Get a list of Uk Country records. + /// + /// + /// The . + /// + [HttpGet] + [Route("GetAllUKCountries")] + public async Task GetAllUKCountries() + { + var list = await this.countryService.GetAllUKCountries(); + return this.Ok(list); + } + + /// + /// Get a list of non Uk Country records. + /// + /// + /// The . + /// + [HttpGet] + [Route("GetAllNonUKCountries")] + public async Task GetAllNonUKCountries() + { + var list = await this.countryService.GetAllNonUKCountries(); + return this.Ok(list); + } } } \ No newline at end of file diff --git a/LearningHub.Nhs.UserApi/Controllers/ElfhUserController.cs b/LearningHub.Nhs.UserApi/Controllers/ElfhUserController.cs index e2441d1..7532c80 100644 --- a/LearningHub.Nhs.UserApi/Controllers/ElfhUserController.cs +++ b/LearningHub.Nhs.UserApi/Controllers/ElfhUserController.cs @@ -923,5 +923,18 @@ public async Task UpgradeAsFullAccessUser(int userId, string emai var result = await this.securityService.UpgradeAsFullAccessUser(userId, email); return this.Ok(result); } + + /// + /// Update MyAccount Personal Details. + /// + /// personalDetailsViewModel. + /// The . + [HttpPut] + [Route("UpdateMyAccountPersonalDetails")] + public async Task UpdateMyAccountPersonalDetails([FromBody] PersonalDetailsViewModel personalDetailsViewModel) + { + await this.elfhUserService.UpdateMyAccountPersonalDetails(personalDetailsViewModel, this.CurrentUserId); + return this.Ok(); + } } } \ No newline at end of file diff --git a/LearningHub.Nhs.UserApi/LearningHub.Nhs.UserApi.csproj b/LearningHub.Nhs.UserApi/LearningHub.Nhs.UserApi.csproj index c707f5a..89a319d 100644 --- a/LearningHub.Nhs.UserApi/LearningHub.Nhs.UserApi.csproj +++ b/LearningHub.Nhs.UserApi/LearningHub.Nhs.UserApi.csproj @@ -23,7 +23,7 @@ - +