using MarketData.MarketDataModel; using MarketData.DataAccess; using MarketDataServer.Authorization; using MarketData; using Microsoft.AspNetCore.Mvc; using LogLevel = MarketData.LogLevel; namespace MarketDataServer.Controllers { [ApiController] [Route("api/[controller]/[action]")] public class PriceIndexController : ControllerBase { //http://localhost:8000/api/PriceIndex/GetDistnctPriceIndices [HttpGet(Name = "GetDistinctPriceIndices")] public IEnumerable GetDistinctPriceIndices(String token) { try { MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetDistinctPriceIndices]",DateTime.Now)); if (!Authorizations.GetInstance().IsAuthorized(token)) return null; return ConsumerPriceIndexDA.GetDistinctIndices(); } catch(Exception exception) { MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}"); return null; } } [HttpGet(Name = "GetConsumerPriceIndex")] public IEnumerable GetConsumerPriceIndex(String token,String indexCode) { try { MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetOpenPositionsWithDescriptionAsOf]",DateTime.Now)); if (!Authorizations.GetInstance().IsAuthorized(token)) return null; PriceIndices priceIndices=ConsumerPriceIndexDA.GetConsumerPriceIndex(indexCode); return priceIndices; } catch(Exception exception) { MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}"); return null; } } } }