Esempio n. 1
0
 internal async Task<MonthPlanDto> GetMonthPlanDtoAsync(string userId, LanguageType languageType) {
     MonthPlanDto statisticDto = Redis.GetMonthPlan(userId, languageType);
     if (statisticDto == null) {
         MonthPlan monthPlan = await _db.GetThisMonthPlanAsync(userId, languageType);
         if (monthPlan == null) {
             int planedCount = CalculateMonthPlan(userId, languageType);
             monthPlan = await _db.CreateMonthPlanAsync(userId, languageType, planedCount);
         }
         statisticDto = new MonthPlanDto(monthPlan);
     }
     return statisticDto;
 }
Esempio n. 2
0
        internal async Task <MonthPlanDto> GetMonthPlanDtoAsync(string userId, LanguageType languageType)
        {
            MonthPlanDto statisticDto = Redis.GetMonthPlan(userId, languageType);

            if (statisticDto == null)
            {
                MonthPlan monthPlan = await _db.GetThisMonthPlanAsync(userId, languageType);

                if (monthPlan == null)
                {
                    int planedCount = CalculateMonthPlan(userId, languageType);
                    monthPlan = await _db.CreateMonthPlanAsync(userId, languageType, planedCount);
                }
                statisticDto = new MonthPlanDto(monthPlan);
            }
            return(statisticDto);
        }