public IEnumerable <IShopFactorChart> GetShopDailyCharts(Guid shopId)
        {
            var date      = DateTime.Now;
            var startDate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
            var factors   = _factorRepository.AsQuery()
                            .Where(p => p.CreationTime >= startDate && p.Shop.Id == shopId && p.FactorState == FactorState.Paid).ToList();
            var shopFactorDailyCharts = new List <ShopFactorChart>();
            var label = 1;

            foreach (var day in EachHours(startDate, date))
            {
                var endDate = day.AddHours(1);
                var shopFactorDailyChart = new ShopFactorChart
                {
                    Label      = Convert.ToString(label),
                    TotalCount = factors.Count(p => p.CreationTime >= day && p.CreationTime <= endDate),
                    TotalSum   = factors.Where(p => p.CreationTime >= day && p.CreationTime <= endDate)
                                 .Sum(p => p.DiscountPrice)
                };
                shopFactorDailyCharts.Add(shopFactorDailyChart);
                label++;
            }

            return(shopFactorDailyCharts);
        }
        public IEnumerable <IShopFactorChart> GetShopYearlyCharts(Guid shopId)
        {
            var date                  = DateTime.Now;
            var startDate             = date.AddMonths(-(date.Month - 1)).AddDays(-(date.Day - 1));
            var shopFactorDailyCharts = new List <ShopFactorChart>();

            foreach (var day in EachYear(startDate, date))
            {
                var endDate = day.AddMonths(1);
                var shopFactorDailyChart = new ShopFactorChart
                {
                    Label      = day.ToFa("y"),
                    TotalCount = _factorRepository.AsQuery().Count(p => p.CreationTime >= day && p.CreationTime <= endDate && p.Shop.Id == shopId && p.FactorState == FactorState.Paid),
                    TotalSum   = _factorRepository.AsQuery().Where(p => p.CreationTime >= day && p.CreationTime <= endDate && p.Shop.Id == shopId && p.FactorState == FactorState.Paid).ToList()
                                 .Sum(p => p.DiscountPrice)
                };
                shopFactorDailyCharts.Add(shopFactorDailyChart);
            }
            return(shopFactorDailyCharts);
        }