Ejemplo n.º 1
0
        public IActionResult MyAccount(int id)
        {
            Adsdb db     = new Adsdb(_connection);
            int   userId = db.GetIdByEmail(User.Identity.Name);

            return(View(db.GetAds(userId)));
        }
Ejemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            Adsdb db     = new Adsdb(_connection);
            int   userId = db.GetIdByEmail(User.Identity.Name);

            db.Delete(id, userId);
            return(Redirect("/"));
        }
Ejemplo n.º 3
0
        public IActionResult Index()
        {
            Adsdb  db         = new Adsdb(_connection);
            AdView view       = new AdView();
            bool   IsLoggedIn = User.Identity.IsAuthenticated;

            if (IsLoggedIn)
            {
                string email = User.Identity.Name;
                view.Id = db.GetIdByEmail(email);
            }
            view.Ads = db.GetAds();
            return(View(view));
        }