public IActionResult DeleteAd(int id) { SimpleAdDb db = new SimpleAdDb(_connectionString); db.Delete(id); return(Redirect("/")); }
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("/")); }