|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
namespace BBWY.Server.API.Controllers
|
|
|
|
{
|
|
|
|
[Produces("application/json")]
|
|
|
|
[Route("Api/[Controller]/[Action]")]
|
|
|
|
[ApiController]
|
|
|
|
public class BaseApiController : ControllerBase
|
|
|
|
{
|
|
|
|
protected IHttpContextAccessor httpContextAccessor;
|
|
|
|
public BaseApiController(IHttpContextAccessor httpContextAccessor)
|
|
|
|
{
|
|
|
|
this.httpContextAccessor = httpContextAccessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected string GetUserId()
|
|
|
|
{
|
|
|
|
return httpContextAccessor?.HttpContext?.User.Claims.Where(x => x.Type == "userId")?.FirstOrDefault()?.Value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|