All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 4s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 11m18s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Successful in 17s
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using BCards.Web.Areas.Support.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Security.Claims;
|
|
|
|
namespace BCards.Web.Areas.Support.Controllers;
|
|
|
|
[Area("Support")]
|
|
[Authorize]
|
|
public class SupportController : Controller
|
|
{
|
|
private readonly ISupportService _supportService;
|
|
private readonly ILogger<SupportController> _logger;
|
|
|
|
public SupportController(ISupportService supportService, ILogger<SupportController> logger)
|
|
{
|
|
_supportService = supportService;
|
|
_logger = logger;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> ContactForm()
|
|
{
|
|
var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
|
var options = await _supportService.GetAvailableOptionsAsync(userId);
|
|
|
|
if (!options.CanUseContactForm)
|
|
{
|
|
_logger.LogWarning("Usuário {UserId} tentou acessar formulário sem permissão", userId);
|
|
TempData["Error"] = "Seu plano atual não tem acesso ao formulário de contato. Faça upgrade para o plano Básico ou superior.";
|
|
return RedirectToAction("Index", "Home", new { area = "" });
|
|
}
|
|
|
|
return View(options);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("Support/Index")]
|
|
public async Task<IActionResult> Index()
|
|
{
|
|
var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
|
var options = await _supportService.GetAvailableOptionsAsync(userId);
|
|
|
|
return View(options);
|
|
}
|
|
}
|