public ActionResult Index(string title, int id) { BlogPost blogpost = db.BlogPosts.FirstOrDefault(x => x.ID == id); SiteBlogPostVM model = new SiteBlogPostVM(); model.Content = blogpost.Content; model.PostImagePath = blogpost.ImagePath; model.Title = blogpost.Title; model.Category = blogpost.Category.Name; model.BlogPostID = blogpost.ID; return View(model); }
// GET: SiteBlog public ActionResult Index(string title, int id)//url'de title'da gözüksün diye title ekledik.İD zaten makeleyi cagırmak için var { BlogPost bp = db.BlogPosts.Where(x=>x.IsDeleted==false).FirstOrDefault(x => x.ID == id); SiteBlogPostVM model = new SiteBlogPostVM(); model.Title = bp.Title; model.Content = bp.Content; model.PostImagePath = bp.ImagePath; model.Category = bp.Category.Name; model.BlogPostID = bp.ID; return View(model); }
// GET: SiteBlog public ActionResult Index(int id) { Blog blog = db.Blogs.FirstOrDefault(x => x.ID == id); SiteBlogPostVM model = new SiteBlogPostVM(); model.Content = blog.Content; model.Title = blog.Title; model.PostImagePath = blog.ImagePath; model.Category = blog.Category.CategoryName; return(View(model)); }