From a35030d0a379ed7ee7fdd403449f53743209059c Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Thu, 8 Aug 2019 17:13:14 +0800 Subject: 2 things. 1. Make Administrator in UserPutRequest nullable. 2. Remove default route. --- Timeline/Controllers/UserController.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'Timeline/Controllers/UserController.cs') diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs index 0992946c..28d9523a 100644 --- a/Timeline/Controllers/UserController.cs +++ b/Timeline/Controllers/UserController.cs @@ -18,8 +18,6 @@ namespace Timeline.Controllers { public const int Get_NotExists = -1001; - public const int Put_NoPassword = -2001; - public const int Patch_NotExists = -3001; public const int ChangePassword_BadOldPassword = -4001; @@ -55,13 +53,7 @@ namespace Timeline.Controllers [HttpPut("user/{username}"), AdminAuthorize] public async Task Put([FromBody] UserPutRequest request, [FromRoute] string username) { - if (request.Password == null) // This place will be refactored. - { - _logger.LogInformation("Attempt to put a user without a password. Username: {} .", username); - return BadRequest(); - } - - var result = await _userService.PutUser(username, request.Password, request.Administrator); + var result = await _userService.PutUser(username, request.Password, request.Administrator.Value); switch (result) { case PutResult.Created: -- cgit v1.2.3