Beispiel #1
0
        public IActionResult DeleteAd(int id)
        {
            SimpleAdDb db = new SimpleAdDb(_connectionString);

            db.Delete(id);
            return(Redirect("/"));
        }
Beispiel #2
0
        public ActionResult DeleteAd(int id)
        {
            SimpleAdDb db = new SimpleAdDb(Properties.Settings.Default.ConStr);

            db.Delete(id);
            return(Redirect("/"));
        }
        public IActionResult DeleteAd(int id)
        {
            List <int> ids = HttpContext.Session.Get <List <int> >("ListingIds");

            if (ids != null && ids.Contains(id))
            {
                SimpleAdDb db = new SimpleAdDb(_connectionString);
                db.Delete(id);
            }

            return(Redirect("/homesession/index"));
        }
        public IActionResult DeleteAd(int id)
        {
            SimpleAdDb db            = new SimpleAdDb(_connectionString);
            var        userIdForAd   = db.GetUserIdForAd(id);
            var        currentUserId = GetCurrentUserId().Value;

            if (currentUserId == userIdForAd)
            {
                db.Delete(id);
            }

            return(Redirect("/"));
        }