Files
TxSearchApi/SearchWebApi/Controllers/LookupController.cs
Roland Fieger 2de05c3856 Initial
2021-08-28 13:11:33 +02:00

57 lines
1.9 KiB
C#

using BusinessLogic.LookupLogic.Interfaces;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace FwSearchApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class LookupController : ControllerBase
{
private readonly IConfiguration _configuration;
private readonly ILogger<LookupController> _logger;
private readonly ILookupLogic _lookupLogic;
public LookupController(IConfiguration configuration, ILogger<LookupController> logger, ILookupLogic lookupLogic)
{
_configuration = configuration;
_logger = logger;
_lookupLogic = lookupLogic;
}
[HttpGet]
[Route("GetAllLookups")]
public async Task<JsonResult> GetAllLookups()
{
var result = await _lookupLogic.GetAllLookups();
_logger.LogInformation($"Lookups zur Verfügung gestellt von {nameof(GetAllLookups)}");
return new JsonResult(result);
}
[HttpGet]
[Route("GetCategoriesById")]
public async Task<JsonResult> GetLookupCategoriesById(long id)
{
var result = await _lookupLogic.GetLookupCategoryById(id);
return new JsonResult(result);
}
[HttpGet]
[Route("GetCategoriesByName")]
public async Task<JsonResult> GetLookupCategoriesByName(string categoryName)
{
var result = await _lookupLogic.GetLookupCategoryByName(categoryName);
return new JsonResult(result);
}
[HttpGet]
[Route("GetActiveCategories")]
public async Task<JsonResult> GetActiveLookupCategories()
{
var result = await _lookupLogic.GetActiveLookupCategories();
return new JsonResult(result);
}
}
}