Example #1
0
        public async Task <IActionResult> Index()
        {
            // Get all line charts
            var lineCharts = await _lineChartService.GetAllLineCharts();

            // ViewModel
            var lineChartViewModel = LineChartBuilder.BuildLineChartViewModel(lineCharts);

            // Return
            return(View("Index", lineChartViewModel));
        }
Example #2
0
 public static Responses.LineChart GetFake_EOS_Price()
 {
     return(new Responses.LineChart
     {
         LineChartId = "eos-price",
         IndicatorType = IndicatorType.CurrencyIndicator,
         CurrencyId = "eos",
         CurrencyName = "EOS",
         IndicatorId = "price",
         IndicatorName = "Price",
         UserId = "master",
         Columns = LineChartBuilder.BuildLineChartColumns(),
         Rows = new List <LineChartRow> {
             new LineChartRow(DateTime.Now, 8.4m, 8m, 4m), new LineChartRow(DateTime.Now.AddMinutes(1), 8.6m, 8m, 4m)
         }
     });
 }
 public static LineChartResponse GetFake_Bitcoin_Price()
 {
     return(new LineChartResponse
     {
         LineChartId = "bitcoin-price",
         IndicatorType = IndicatorType.CurrencyIndicator,
         TargetId = "bitcoin",
         TargetName = "Bitcoin",
         IndicatorId = "price",
         IndicatorName = "Price",
         UserId = "master",
         Columns = LineChartBuilder.BuildLineChartColumns(),
         Rows = new List <LineChartRow> {
             new LineChartRow(DateTime.Now, 6.4m, 8m, 4m), new LineChartRow(DateTime.Now.AddMinutes(1), 6.6m, 8m, 4m)
         }
     });
 }
Example #4
0
        public async Task <List <Responses.LineChart> > GetAllLineCharts(string currencyId = null, IndicatorType?indicatorType = null, string indicatorId = null, string userId = null)
        {
            // Get all currencies
            var currencies = await _currencyRepository.GetAll(CurrencyExpression.CurrencyFilter(currencyId));

            // Get all indicators
            var indicators = await _indicatorRepository.GetAll(IndicatorExpression.IndicatorFilter(indicatorType, indicatorId, userId));

            // Get all lines
            var lines = await _lineRepository.GetAll(LineExpression.LineFilter(currencyId, indicatorType, indicatorId, userId));

            // Build
            var lineCharts = LineChartBuilder.BuildLineCharts(currencies, indicators, lines);

            // Response
            var response = _mapper.Map <List <Responses.LineChart> >(lineCharts);

            // Return
            return(response);
        }