public ActionResult AdsForUsers() { User user = SqlUser.GetUser(User.Identity.Name); List <Advertisement> ads = SqlAdvertisement.GetAdvertisements(user.UserID); return(View(ads)); }
// GET: Advertisement public ActionResult Index() { List <Advertisement> ads = null; User user = SqlUser.GetUser(User.Identity.Name); if (user != null) { ads = SqlAdvertisement.GetAdvertisements(user.UserID); return(View(ads)); } else { return(RedirectToAction("Login", "User")); } }