REST-ify dictionary and language controllers (#13531)

* Update signatures to always return ActionResult<> or IActionResult

* Make a few endpoints more RESTish

* Update OpenAPI json
This commit is contained in:
Kenn Jacobsen
2022-12-12 15:03:36 +01:00
committed by GitHub
parent 1fd4ed1de7
commit e397ac9011
6 changed files with 226 additions and 221 deletions

View File

@@ -24,15 +24,15 @@ public class UpdateLanguageController : LanguageControllerBase
/// <summary>
/// Updates a language
/// </summary>
[HttpPut("update")]
[HttpPut("{id:int}")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status200OK)]
// TODO: This needs to be an authorized endpoint.
public async Task<ActionResult> Update(LanguageViewModel language)
public async Task<ActionResult> Update(int id, LanguageViewModel language)
{
ILanguage? existingById = language.Id != default ? _localizationService.GetLanguageById(language.Id) : null;
ILanguage? existingById = _localizationService.GetLanguageById(id);
if (existingById is null)
{
return await Task.FromResult(NotFound());