File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
LearningHub.Nhs.OpenApi.Services.Interface/Services
LearningHub.Nhs.OpenApi.Services/Services
LearningHub.Nhs.OpenApi/Controllers Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -238,5 +238,13 @@ public interface ICatalogueService
238238 /// <returns>The allcatalogue result based on letters.</returns>
239239 Task < AllCatalogueResponseViewModel > GetAllCataloguesAsync ( string filterChar , int userId ) ;
240240
241+ /// <summary>
242+ /// The UpdateCatalogueOwnerAsync.
243+ /// </summary>
244+ /// <param name="userId">The userId.</param>
245+ /// <param name="catalogueOwner">The catalogue owner.</param>
246+ /// <returns>The catalogue view model.</returns>
247+ Task < LearningHubValidationResult > UpdateCatalogueOwnerAsync ( int userId , CatalogueOwnerViewModel catalogueOwner ) ;
248+
241249 }
242250}
Original file line number Diff line number Diff line change @@ -1190,6 +1190,18 @@ private LearningHubValidationResult ValidateEditAsync(CatalogueViewModel model)
11901190 IsValid = ! details . Any ( ) ,
11911191 } ;
11921192 }
1193+ /// <summary>
1194+ /// The UpdateCatalogueOwnerAsync.
1195+ /// </summary>
1196+ /// <param name="userId">The userId.</param>
1197+ /// <param name="catalogueOwner">The catalogue owner.</param>
1198+ /// <returns>The catalogue view model.</returns>
1199+ public async Task < LearningHubValidationResult > UpdateCatalogueOwnerAsync ( int userId , CatalogueOwnerViewModel catalogueOwner )
1200+ {
1201+ await this . catalogueNodeVersionRepository . UpdateCatalogueOwnerAsync ( userId , catalogueOwner ) ;
1202+
1203+ return new LearningHubValidationResult ( true ) ;
1204+ }
11931205
11941206 }
11951207}
Original file line number Diff line number Diff line change @@ -374,5 +374,25 @@ public async Task<IActionResult> AcceptAccessRequest(int accessRequestId)
374374 return this . Ok ( await this . catalogueService . AcceptAccessAsync ( this . CurrentUserId . GetValueOrDefault ( ) , accessRequestId ) ) ;
375375 }
376376
377+ /// <summary>
378+ /// The UpdateCatalogueOwner.
379+ /// </summary>
380+ /// <param name="viewModel">The catalogue owner.</param>
381+ /// <returns>The updated catalogue owner.</returns>
382+ [ HttpPut ]
383+ [ Route ( "UpdateCatalogueOwner" ) ]
384+ public async Task < IActionResult > UpdateCatalogueOwner ( CatalogueOwnerViewModel viewModel )
385+ {
386+ try
387+ {
388+ var vr = await this . catalogueService . UpdateCatalogueOwnerAsync ( this . CurrentUserId . GetValueOrDefault ( ) , viewModel ) ;
389+ return this . Ok ( new ApiResponse ( true , vr ) ) ;
390+ }
391+ catch ( Exception ex )
392+ {
393+ return this . Ok ( new ApiResponse ( false , new LearningHubValidationResult ( false , ex . Message ) ) ) ;
394+ }
395+ }
396+
377397 }
378398}
You can’t perform that action at this time.
0 commit comments