Beispiel #1
0
        public IActionResult NewAd()
        {
            var    pwDb  = new PasswordDbMgr(_connection);
            string email = User.Identity.Name;
            var    user  = pwDb.GetUserByEmail(email);

            return(View(user.Id));
        }
Beispiel #2
0
        public IActionResult MyAccount()
        {
            var    adDb  = new AdDbMgr(_connection);
            var    pwDb  = new PasswordDbMgr(_connection);
            string email = User.Identity.Name;
            var    user  = pwDb.GetUserByEmail(email);
            var    vm    = new MyAccountViewModel
            {
                Ads = adDb.GetAdsForUser(user.Id)
            };

            return(View(vm));
        }
Beispiel #3
0
        public IActionResult Index()
        {
            AdDbMgr       adDb = new AdDbMgr(_connection);
            PasswordDbMgr pwDb = new PasswordDbMgr(_connection);
            var           vm   = new HomePageViewModel();

            vm.Ads      = adDb.GetAllAds();
            vm.LoggedIn = User.Identity.IsAuthenticated;
            if (vm.LoggedIn)
            {
                string email = User.Identity.Name;
                var    user  = pwDb.GetUserByEmail(email);
                vm.UserId = user.Id;
            }

            return(View(vm));
        }