35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using CleanArchitecture.Application.Contracts.Identity;
|
|
using CleanArchitecture.Application.Models.Identity;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Identity.Data;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace CleanArchitecture.API.Controllers
|
|
{
|
|
[Route("api/v1/[controller]")]
|
|
[ApiController]
|
|
public class AccountController : ControllerBase
|
|
{
|
|
private readonly IAuthService authService;
|
|
|
|
public AccountController(IAuthService _authService)
|
|
{
|
|
authService = _authService;
|
|
}
|
|
|
|
[HttpPost("login")]
|
|
public async Task<ActionResult<AuthResponse>> Login([FromBody] AuthRequest request)
|
|
{
|
|
var response = await authService.Login(request);
|
|
return Ok(response);
|
|
}
|
|
|
|
[HttpPost("register")]
|
|
public async Task<ActionResult<RegistrationResponse>> Register([FromBody] RegistrationRequest request)
|
|
{
|
|
var response = await authService.Register(request);
|
|
return Ok(response);
|
|
}
|
|
}
|
|
}
|