Exemple #1
0
        public ActionResult Delete(delete_action model)
        {
            bgk_yazi post = Db.bgk_yazi.Find(model.Id);

            BGKFunction.DeletePost(post);
            Db.bgk_yazi.Remove(post);
            Db.SaveChanges();
            return(Content("<script>$.BGK.SuccessModal('Yazı başarılı bir şekilde silindi.', function (){ window.location.href='" + Url.Action("index") + "'; }, 1500);</script>"));
        }
Exemple #2
0
        public ActionResult Details(int num = 0)
        {
            bgk_yazi post = Db.bgk_yazi.Find(num);

            if (post == null)
            {
                return(Content("<script>$.BGK.ErrorModal('Bir sorun oluştu. Lütfen daha sonra tekrar deneyiniz.');</script>"));
            }
            return(PartialView(post));
        }
Exemple #3
0
        public ActionResult Edit(int num = 0)
        {
            bgk_yazi post = Db.bgk_yazi.Find(num);

            if (post == null)
            {
                return(HttpNotFound());
            }
            ViewBag.KategoriID = new SelectList(Db.bgk_kategori, "Id", "Adi", post.KategoriID);
            return(View(post));
        }
Exemple #4
0
 public ActionResult Edit(bgk_yazi post)
 {
     if (ModelState.IsValid)
     {
         Db.Entry(post).State = EntityState.Modified;
         post.Seo             = post.Baslik.ConvertSeo();
         Db.SaveChanges();
         return(RedirectToAction("index"));
     }
     ViewBag.KategoriID = new SelectList(Db.bgk_kategori, "Id", "Adi", post.KategoriID);
     return(View(post));
 }
Exemple #5
0
        public ActionResult ChangeApproval(int num = 0)
        {
            string   result = "";
            bgk_yazi post   = Db.bgk_yazi.Find(num);

            if (post != null)
            {
                result    = post.Onay ? "Yazının onayı başarıyla kaldırıldı." : "Yazı başarıyla onaylandı.";
                post.Onay = !post.Onay;
                Db.SaveChanges();
            }
            return(Content("<script>$.BGK.SuccessModal('" + result + "');</script>"));
        }
Exemple #6
0
        public ActionResult Delete(int num = 0)
        {
            bgk_yazi post = Db.bgk_yazi.Find(num);

            if (post == null)
            {
                return(Content("<script>$.BGK.ErrorModal('Bir sorun oluştu. Lütfen daha sonra tekrar deneyiniz.');</script>"));
            }
            return(PartialView("DeleteActions", new delete_action()
            {
                Id = num, Title = post.Baslik, Message = "Bu yazıyı ve bu yazıya ait yorumları silmek istediğinizden emin misiniz?"
            }));
        }
        public static void DeletePost(bgk_yazi post)
        {
            BGKEntities Db = new BGKEntities();

            foreach (var comment in post.bgk_yorum)
            {
                Db.bgk_yorum.Remove(comment);
            }
            foreach (var rating in post.bgk_oylama)
            {
                Db.bgk_oylama.Remove(rating);
            }
            Db.bgk_yazi.Remove(post);
            Db.SaveChanges();
        }
Exemple #8
0
 public ActionResult Create(bgk_yazi post)
 {
     if (ModelState.IsValid)
     {
         int memberID = (int)Session["memberID"];
         post.UyeID       = memberID;
         post.Seo         = post.Baslik.ConvertSeo();
         post.YazimTarihi = DateTime.Now;
         post.Okunma      = 0;
         Db.bgk_yazi.Add(post);
         Db.SaveChanges();
         return(RedirectToAction("index"));
     }
     ViewBag.KategoriID = new SelectList(Db.bgk_kategori, "Id", "Adi");
     return(View(post));
 }
Exemple #9
0
 public ActionResult Create(bgk_yazi model)
 {
     if (ModelState.IsValid)
     {
         model.Seo         = model.Baslik.ConvertSeo();
         model.YazimTarihi = DateTime.Now;
         model.UyeID       = (int)Session["memberID"];
         model.Onay        = BGKFunction.GetMyRole().YaziOnay;
         model.Manset      = false;
         model.Okunma      = 0;
         Db.bgk_yazi.Add(model);
         Db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     ViewBag.KategoriID = new SelectList(Db.bgk_kategori.Where(x => x.Onay == true), "Id", "Adi");
     return(View(model));
 }