44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Serwer.Infrastructure.DTO;
|
|
using Serwer.Infrastructure.Services;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Serwer.Api.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class UserController : ControllerBase
|
|
{
|
|
private readonly IUserService _userService;
|
|
public UserController(IUserService userService)
|
|
{
|
|
_userService = userService;
|
|
}
|
|
|
|
[HttpPost("Register")]
|
|
public async Task<IActionResult> Register(string email, string name, string surname, string login, string password)
|
|
{
|
|
await _userService.RegisterAsync(email, name, surname, login, password);
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[HttpPost("SignIn")]
|
|
public async Task<IActionResult> SignIn(string login, string password)
|
|
{
|
|
var user = await _userService.SignInAsync(login, password);
|
|
return Ok(user);
|
|
}
|
|
|
|
[HttpGet("Test")]
|
|
public IActionResult Test()
|
|
{
|
|
return NoContent();
|
|
}
|
|
}
|
|
}
|