// GET: Haber #endregion #region Haber İçerik public ActionResult Icerik(int id, int sayfa = 1) { ViewBag.Kategoriler = _kategoriRepository.GetAll(); //ViewBag.Yorumlar = _yorumRepository.GetMany(x => x.HaberID == id); var YorumListe = _yorumRepository.GetMany(x => x.HaberID == id); ViewBag.YorumSayisi = _yorumRepository.HaberYorumSayisi(id).ToString(); var haber = _haberRepository.GetByID(id); ViewBag.Haber = haber; OkunmaSayisiArttir(id); //return View(haber); return(View(YorumListe.OrderBy(x => x.EklenmeTarihi).ToPagedList(sayfa, 5))); }
public ActionResult YorumSil(int id) { var sessionControl = HttpContext.Session["ID"]; var yorum = _yorumRepository.GetMany(y => y.ID == id).SingleOrDefault(); var makale = _makaleRepository.GetMany(m => m.ID == yorum.MakaleID).SingleOrDefault(); if (yorum.KullaniciID == Convert.ToInt32(sessionControl)) { _yorumRepository.Delete(id); _yorumRepository.Save(); return(RedirectToAction("Detay", "Makale", new { id = makale.ID })); } else { return(HttpNotFound()); } }
public ActionResult Detay(string SeoLink) { #region ORTAK ViewBag.Kategoris = _kategoriRepository.GetAll(); List <int> countByCategoryID = new List <int>(); foreach (var item in _kategoriRepository.GetAll()) { countByCategoryID.Add(_blogRepository.CountByKategori(item.ID)); } ViewBag.KategoriPostSayilari = countByCategoryID; #endregion ViewBag.Yorums = _yorumRepository.GetMany(x => x.Blog.SeoLink == SeoLink); Blog blogModel = _blogRepository.Get(x => x.SeoLink == SeoLink); blogModel.Hit++; _blogRepository.Update(blogModel); _blogRepository.Save(); return(View(blogModel)); }
public ActionResult HaberYorumlari(int id, int sayfa = 1) { var haberYorumlari = _yorumRepository.GetMany(x => x.HaberID == id); return(View(haberYorumlari.OrderByDescending(x => x.EklenmeTarihi).ToPagedList(sayfa, 3))); }