Files
myoffice/MyOffice.Web/Controllers/GeneralController.cs
T
2023-07-31 08:50:05 +03:00

34 lines
706 B
C#

namespace MyOffice.Web.Controllers;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Models.Currency;
using Services.Currency;
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class GeneralController : BaseApiController
{
private readonly CurrencyService _currencyService;
private readonly IMapper _mapper;
public GeneralController(
CurrencyService currencyService,
IMapper mapper
)
{
_currencyService = currencyService;
_mapper = mapper;
}
[HttpGet("~/api/general/currencies")]
public ObjectResult Get()
{
var list = _currencyService.GetGlobalAll();
return Ok(_mapper.Map<List<CurrencyGlobalViewModel>>(list));
}
}