public IActionResult Index() { if (!User.Identity.IsAuthenticated) { return(Redirect("/Identity/Account/Login")); } var plants = plantService.GetAllPlantsForWateringOfUser(User.Identity.Name); IEnumerable <PlantCardViewModel> plantCards = plants.Select(x => new PlantCardViewModel() { Id = x.Id, Name = x.Name }); HomeViewModel hvm = new HomeViewModel() { plantCards = plantCards }; return(View(hvm)); }