Esempio n. 1
0
        public async Task <IActionResult> GetRecipeLogs(string id, int skip = 0, int take = 100)
        {
            var recipe = await _recipeManager.GetRecipe(id, _userManager.GetUserId(User));

            if (recipe == null)
            {
                return(GetNotFoundActionResult());
            }

            var recipeInvocations = await _recipeManager.GetRecipeInvocations(new RecipeInvocationsQuery()
            {
                Skip     = skip,
                Take     = take,
                RecipeId = id,
                OrderBy  = new OrderBy <RecipeInvocationsQuery.RecipeInvocationsQueryOrderBy>()
                {
                    Field     = RecipeInvocationsQuery.RecipeInvocationsQueryOrderBy.Timestamp,
                    Direction = OrderDirection.Descending
                }
            });

            return(View(new GetRecipeLogsViewModel()
            {
                Name = recipe.Name,
                Id = id,
                Skip = skip,
                Take = take,
                RecipeInvocations = recipeInvocations.ToList()
            }));
        }