36 lines
842 B
C#
36 lines
842 B
C#
namespace MyOffice.Web.Controllers;
|
|
|
|
using AutoMapper;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Models.Currency;
|
|
using Services.Currency;
|
|
using MyOffice.Web.Infrastructure.Attributes;
|
|
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/general")]
|
|
[DefaultFromBody]
|
|
public class GeneralController : BaseApiController
|
|
{
|
|
private readonly CurrencyService _currencyService;
|
|
private readonly IMapper _mapper;
|
|
|
|
public GeneralController(
|
|
CurrencyService currencyService,
|
|
IMapper mapper
|
|
)
|
|
{
|
|
_currencyService = currencyService;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
[HttpGet("currencies")]
|
|
public async Task<ObjectResult> GetGlobalCurrencies(CancellationToken cancellationToken)
|
|
{
|
|
var list = await _currencyService.GetGlobalAllAsync(cancellationToken);
|
|
|
|
return Ok(_mapper.Map<List<CurrencyGlobalViewModel>>(list));
|
|
}
|
|
}
|