// public class testservice{

        public async Task <AllChildrenGraphViewModel> GetComparisonGraphAsync(int ChildId)
        {
            var model = new ChildGraphViewModel();
            var rtn   = new AllChildrenGraphViewModel();
            //var p1 = BL.GetGroupedPointsforDayGraphAsync(ChildId);
            //var p2 = BL.GetPlusNegativePointsforLastMonthAsync(ChildId);
            //var p3 = BL.GetGroupedPointsforWeekGraphAsync(ChildId);
            //var p4 = BL.GetPointsforLastSevenDaysAsync(ChildId);
            var p5 = await BL.GetPointsforDayGraphAsync(ChildId);

            //var p6 = BL.GetPointsforLastMonthAsync(ChildId);
            //var p7 = BL.GetPlusNegativePointsforLastWeekAsync(ChildId);


            //  Task.WhenAll( p5);
            //model.groupPointsForDay = p1.Result;
            //model.plusnegativeForMonth = p2.Result;
            //model.groupPointsForWeek = p3.Result;
            //model.sevenDays = p4.Result;
            model.currentDay = p5;// p5.Result;
            //model.lastMonth = p6.Result;
            //model.plusnegativeForWeek = p7.Result;
            rtn.ChildGraph = model;

            return(rtn);
        }
        public async Task <AllChildrenGraphViewModel> GetGraphAsync(int ChildId, BusinessRules BL, bool bGetAll)
        {
            var model = new ChildGraphViewModel();
            var rtn   = new AllChildrenGraphViewModel();
            var p1    = BL.GetGroupedPointsforDayGraphAsync(ChildId);
            var p2    = BL.GetPlusNegativePointsforLastMonthAsync(ChildId);
            var p3    = BL.GetGroupedPointsforWeekGraphAsync(ChildId);
            var p4    = BL.GetPointsforLastSevenDaysAsync(ChildId);
            var p5    = BL.GetPointsforDayGraphAsync(ChildId);
            var p6    = BL.GetPointsforLastMonthAsync(ChildId);
            var p7    = BL.GetPlusNegativePointsforLastWeekAsync(ChildId);

            if (bGetAll == true)
            {
                var p8 = GetAllChildrenGraphDataAsync();
                Task.WhenAll(p1, p2, p3, p4, p5, p6, p7, p8);
                // var allchildren = await GetAllChildrenGraphDataAsync();
                //  rtn.ChildGraphList = allchildren;
                model.groupPointsForDay    = p1.Result;
                model.plusnegativeForMonth = p2.Result;
                model.groupPointsForWeek   = p3.Result;
                model.sevenDays            = p4.Result;
                model.currentDay           = p5.Result;
                model.lastMonth            = p6.Result;
                model.plusnegativeForWeek  = p7.Result;
                var allchildren = p8.Result;
                rtn.ChildGraphList = allchildren;
            }
            else
            {
                Task.WhenAll(p1, p2, p3, p4, p5, p6, p7);
                model.groupPointsForDay    = p1.Result;
                model.plusnegativeForMonth = p2.Result;
                model.groupPointsForWeek   = p3.Result;
                model.sevenDays            = p4.Result;
                model.currentDay           = p5.Result;
                model.lastMonth            = p6.Result;
                model.plusnegativeForWeek  = p7.Result;
            }

            //  Task.WhenAll(p1, p2, p3, p4, p5, p6, p7);

            //model.groupPointsForDay = p1.Result;
            //model.plusnegativeForMonth = p2.Result;
            //model.groupPointsForWeek = p3.Result;
            //model.sevenDays = p4.Result;
            //model.currentDay = p5.Result;
            //model.lastMonth = p6.Result;
            //model.plusnegativeForWeek = p7.Result;

            ////model.groupPointsForDay = await BL.GetGroupedPointsforDayGraphAsync(ChildId);
            ////model.plusnegativeForMonth = await BL.GetPlusNegativePointsforLastMonthAsync(ChildId);
            ////model.groupPointsForWeek = await BL.GetGroupedPointsforWeekGraphAsync(ChildId);
            ////model.sevenDays = await BL.GetPointsforLastSevenDaysAsync(ChildId);
            ////model.currentDay = await BL.GetPointsforDayGraphAsync(ChildId);
            ////model.lastMonth = await BL.GetPointsforLastMonthAsync(ChildId);
            ////model.plusnegativeForWeek = await BL.GetPlusNegativePointsforLastWeekAsync(ChildId);
            rtn.ChildGraph = model;
            //if (bGetAll == true) {
            //   // var allchildren = await GetAllChildrenGraphDataAsync();
            //   var allchildren = p8.
            //    rtn.ChildGraphList = allchildren;
            //}
            return(rtn);
        }