From b86c8cf5130d21ac56e733640cecd08945d30e6d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 18 Apr 2019 21:23:21 +0800 Subject: Add user management REST api. --- Timeline/Controllers/UserController.cs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'Timeline/Controllers/UserController.cs') diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs index 147724c1..285e0146 100644 --- a/Timeline/Controllers/UserController.cs +++ b/Timeline/Controllers/UserController.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using System; using System.Threading.Tasks; using Timeline.Entities; using Timeline.Services; @@ -71,21 +70,5 @@ namespace Timeline.Controllers UserInfo = result }); } - - [HttpPost("[action]")] - [Authorize(Roles = "admin")] - public async Task> CreateUser([FromBody] CreateUserRequest request) - { - var result = await _userService.CreateUser(request.Username, request.Password, request.Roles); - switch (result) - { - case CreateUserResult.Success: - return Ok(new CreateUserResponse { ReturnCode = CreateUserResponse.SuccessCode }); - case CreateUserResult.AlreadyExists: - return Ok(new CreateUserResponse { ReturnCode = CreateUserResponse.AlreadyExistsCode }); - default: - throw new Exception("Unreachable code."); - } - } } } -- cgit v1.2.3