Ejemplo n.º 1
0
        public static MealPlanModel?[] GetMealPlansForWeek(
            this Dictionary <string, MealPlanV2> MealPlans,
            UserDataAction userAction,
            DateTime?startDate,
            Dictionary <long, MealTime> MealTimes,
            Dictionary <long, Recipe> Recipes,
            Random rand)
        {
            var today = DateTime.UtcNow.AddDays(-1);

            if (MealTimes.Count == 0 || Recipes.Count == 0)
            {
                return(Array.Empty <MealPlanModel>());
            }

            DateTime?start = null;

            if (startDate is { })
Ejemplo n.º 2
0
        public async Task <UserDataAction> GetUserData(long userId)
        {
            if (userId < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(userId));
            }

            if (_cache.TryGetValue(userId, out UserDataAction user))
            {
                return(user);
            }
            else
            {
                var newUser = await UserDataAction.Create(persistenceRef, fetchRef, userId);

                _cache.Set(userId, newUser, _option);
                return(newUser);
            }
        }