Na most működig SWAGGER és 5000 porton publishban is !
This commit is contained in:
@@ -10,20 +10,41 @@ namespace WorkFlowCheck.API.Controllers
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
private IUserService _userService;
|
||||
|
||||
public UserController(IUserService userService)
|
||||
{
|
||||
_userService = userService;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<ApiResponseDTO<UserDTO>> Get()
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ApiResponseDTO<UserDTO>> Get(int id)
|
||||
{
|
||||
var userDTO = await _userService.GetUser(1);
|
||||
var retVal = new ApiResponseDTO<UserDTO>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Data = userDTO
|
||||
};
|
||||
|
||||
var userDTO = await _userService.GetUser(id);
|
||||
|
||||
if (userDTO != null)
|
||||
{
|
||||
if (userDTO.Id == 0)
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No match!");
|
||||
retVal.Data = userDTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = userDTO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user