Add UnemploymentData
This commit is contained in:
59
MarketDataServer/Controllers/EconomicindicatorsController.cs
Normal file
59
MarketDataServer/Controllers/EconomicindicatorsController.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.DataAccess;
|
||||
using MarketDataServer.Authorization;
|
||||
using MarketData;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LogLevel = MarketData.LogLevel;
|
||||
using MarketData.Utils;
|
||||
|
||||
namespace MarketDataServer.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class EconomicIndicastorsController : ControllerBase
|
||||
{
|
||||
//http://localhost:8000/api/EconomicIndicators/GetDistnctIndicators
|
||||
[HttpGet(Name = "GetDistinctEconomicIndicators")]
|
||||
public IEnumerable<String> GetDistinctEconomicIndicators(String token)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
return EconomicIndicatorDA.GetDistinctIndicators();
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetEconomicIndicators")]
|
||||
public IEnumerable<EconomicIndicator> GetEconomicIndicators(String token,String indicatorCode)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
EconomicIndicators economicIndicators=EconomicIndicatorDA.GetEconomicIndicators(indicatorCode);
|
||||
return economicIndicators;
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user