Example #1
0
        public IActionResult Index()
        {
            SimpleAdsDb   db = new SimpleAdsDb(_connectionString);
            HomeViewModel vm = new HomeViewModel
            {
                Ads             = db.GetAllAds(),
                IsAuthenticated = User.Identity.IsAuthenticated
            };

            if (User.Identity.IsAuthenticated)
            {
                var email = User.Identity.Name;
                vm.CurrentUser = db.GetByEmail(email);
            }
            return(View(vm));
        }