/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Infrastructure.Authentication.Local/Controllers/RegistrationController.cs
31 строка
1 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using Gridient.Infrastructure.Authentication.Local.Features.Registration.Commands; using Gridient.Infrastructure.Authentication.Local.Models; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Gridient.Infrastructure.Authentication.Local.Controllers { [ApiController] [Route("api/auth")] public class RegistrationController(IMediator mediator) : ControllerBase { private readonly IMediator _mediator = mediator; [HttpPost("register")] [AllowAnonymous] public async Task<IActionResult> Register([FromBody] RegisterModel model, CancellationToken cancellationToken) { try { var command = new RegisterCommand(model); await _mediator.Send(command, cancellationToken); return Ok(new { message = "Пользователь успешно зарегистрирован" }); } catch (InvalidOperationException ex) { return Conflict(new { message = ex.Message }); } } } }