using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Kendo.Mvc.UI;
using Telerik.DSR.Sample.Models;
using Kendo.Mvc.Extensions;

namespace Telerik.DSR.Sample.Controllers
{
    public class GridController : Controller
    {
        private readonly IChartRepository _chartRepository;

        public GridController(IChartRepository chartRepository)
        {
            _chartRepository = chartRepository;
        }
       

        public ActionResult GetItemNumbers()
        {
            var result = _chartRepository.AllItemNumbers;
            return Json(result);
        }

        public ActionResult ChartData_Read([DataSourceRequest]DataSourceRequest request)
        {

            var ordersData = _chartRepository.AllOrdersByCountry.ToList();
             return Json(ordersData);

        }

        public ActionResult SampleMethodTest([DataSourceRequest]DataSourceRequest request
                                                , string[] itemFilter)
        {
            if (!itemFilter.Any())
            {

            }

            var ordersData = _chartRepository.AllOrdersByCountry.ToList();
            return Json(ordersData);

        }
    }
}
