public async void OnGetAsync(bool All = true, string uId = null) { if (All || uId == null) { DayRecipes = await _context.DayRecipes .Include(r => r.DayRecipeFood) .ThenInclude(f => f.Food) .ToListAsync();; } else { DayRecipes = await _context.DayRecipes.Where(r => r.RecipeUser.ToString() == uId) .Include(r => r.DayRecipeFood) .ThenInclude(f => f.Food) .ToListAsync(); } Events = new List <CalendarItem>(); foreach (DayRecipes dr in DayRecipes) { CalendarItem e = new CalendarItem(); e.Title = dr.RecipeName; e.Url = $"/User/DayRecipe/Edit?id={dr.RecipeId}&tics={dr.RecipeDate.Ticks}"; e.SetHighlightClass("OK"); } }