|
|
@ -21,6 +21,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("users/{page}/{number}")]
|
|
|
|
[HttpGet("users/{page}/{number}")]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult GetUsers(int page, int number)
|
|
|
|
public IActionResult GetUsers(int page, int number)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var nbUser = _userDataService.GetUsers(page, number).Count();
|
|
|
|
var nbUser = _userDataService.GetUsers(page, number).Count();
|
|
|
@ -32,6 +33,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("user/id/{id}")]
|
|
|
|
[HttpGet("user/id/{id}")]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult GetUserById(int id)
|
|
|
|
public IActionResult GetUserById(int id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -45,6 +47,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("user/username/{username}")]
|
|
|
|
[HttpGet("user/username/{username}")]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult GetUserByUsername(string username)
|
|
|
|
public IActionResult GetUserByUsername(string username)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -58,6 +61,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpDelete]
|
|
|
|
[HttpDelete]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult DeleteUser(int id)
|
|
|
|
public IActionResult DeleteUser(int id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var sucess = _userDataService.DeleteUser(id);
|
|
|
|
var sucess = _userDataService.DeleteUser(id);
|
|
|
@ -72,6 +76,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult UpdateUser(string username, string password, string email, bool isAdmin)
|
|
|
|
public IActionResult UpdateUser(string username, string password, string email, bool isAdmin)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -80,6 +85,7 @@ namespace API.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPut]
|
|
|
|
[HttpPut]
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
public IActionResult CreateUser(int id, [FromBody] UserDTO userDTO)
|
|
|
|
public IActionResult CreateUser(int id, [FromBody] UserDTO userDTO)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(id != userDTO.Id)
|
|
|
|
if(id != userDTO.Id)
|
|
|
|