public ActionResult ADClick(int?id) { if (id == null) { return(RedirectToAction("Home")); } AD ad = db.ADS.Find(id); if (ad == null) { return(RedirectToAction("Home")); } db.ADClick(ad.ID); return(Redirect(ad.Link)); }