|
|
@ -1,11 +1,12 @@
|
|
|
|
using Dto;
|
|
|
|
using Dto;
|
|
|
|
|
|
|
|
using Asp.Versioning;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Shared;
|
|
|
|
using Shared;
|
|
|
|
|
|
|
|
|
|
|
|
namespace API.Controllers
|
|
|
|
namespace API.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[Route("api/{version:apiVersion}/[controller]")]
|
|
|
|
[Route("api/v{version:apiVersion}/[controller]")]
|
|
|
|
[Authorize]
|
|
|
|
[Authorize]
|
|
|
|
[ApiVersion("1.0")]
|
|
|
|
[ApiVersion("1.0")]
|
|
|
|
[ApiController]
|
|
|
|
[ApiController]
|
|
|
@ -14,7 +15,7 @@ namespace API.Controllers
|
|
|
|
[HttpGet("users/{page}/{number}")]
|
|
|
|
[HttpGet("users/{page}/{number}")]
|
|
|
|
[ProducesResponseType(typeof(UserDTO), 200)]
|
|
|
|
[ProducesResponseType(typeof(UserDTO), 200)]
|
|
|
|
[ProducesResponseType(typeof(string), 204)]
|
|
|
|
[ProducesResponseType(typeof(string), 204)]
|
|
|
|
public IActionResult GetUsers(int page, int number)
|
|
|
|
public IActionResult GetUsers(int page, int number)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var users = userService.GetUsers(page, number).ToList();
|
|
|
|
var users = userService.GetUsers(page, number).ToList();
|
|
|
|
if (users.Count == 0)
|
|
|
|
if (users.Count == 0)
|
|
|
@ -82,7 +83,7 @@ namespace API.Controllers
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
[ProducesResponseType(typeof(UserDTO), 201)]
|
|
|
|
[ProducesResponseType(typeof(UserDTO), 201)]
|
|
|
|
[ProducesResponseType(typeof(string), 400)]
|
|
|
|
[ProducesResponseType(typeof(string), 400)]
|
|
|
|
public IActionResult CreateUser([FromBody]UserDTO dto)
|
|
|
|
public IActionResult CreateUser([FromBody] UserDTO dto)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (dto.Username == null || dto.Password == null || dto.Email == null)
|
|
|
|
if (dto.Username == null || dto.Password == null || dto.Email == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|