Na most működig SWAGGER és 5000 porton publishban is !

This commit is contained in:
2025-01-15 17:26:09 +01:00
parent a2906cc113
commit 6a46975cfd
7 changed files with 55 additions and 28 deletions
@@ -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;
}
}