Exemple #1
0
        public async Task <IActionResult> Index()
        {
            dynamic Models   = new ExpandoObject();
            var     userJSON = HttpContext.Session.GetString("profile");

            if (userJSON == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            var userProfile = JsonConvert.DeserializeObject <Profile>(userJSON);
            var favorites   = await _context.GetFavorites(userProfile.UserID);

            Models.Favorites = favorites;
            Models.User      = userProfile;
            return(View(Models));
        }