public ActionResult Details(int num = 0) { club_post post = Db.club_post.Find(num); if (post == null) { return(HttpNotFound()); } return(View(post)); }
public ActionResult Edit(int num = 0) { club_post post = Db.club_post.Find(num); if (post == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(Db.club_category, "Id", "Name"); return(View(post)); }
public ActionResult Edit(club_post post) { if (ModelState.IsValid) { Db.Entry(post).State = EntityState.Modified; post.Seo = OK.ConvertSeo(post.Title); Db.SaveChanges(); return(RedirectToAction("index")); } ViewBag.CategoryId = new SelectList(Db.club_category, "Id", "Name"); return(View(post)); }
public ActionResult DeleteConfirmed(int num) { club_post post = Db.club_post.Find(num); foreach (var comment in post.club_comments.ToList()) { Db.club_postcomment.Remove(comment); } Db.club_post.Remove(post); Db.SaveChanges(); return(RedirectToAction("index")); }
public ActionResult Create(club_post post) { if (ModelState.IsValid) { int userid = (int)Session["memberid"]; post.MemberId = userid; post.Seo = OK.ConvertSeo(post.Title); post.WritingDate = DateTime.Now; post.ModifyDate = DateTime.Now; Db.club_post.Add(post); Db.SaveChanges(); return(RedirectToAction("index")); } ViewBag.CategoryId = new SelectList(Db.club_category, "Id", "Name"); return(View(post)); }
public ActionResult CreatePost(club_post model) { if (ModelState.IsValid) { model.Seo = OK.ConvertSeo(model.Title); model.MemberId = (int)Session["memberid"]; model.WritingDate = DateTime.Now; model.ModifyDate = DateTime.Now; var groupmember = Db.club_groupmember.SingleOrDefault(x => x.GroupId == model.GroupId && x.MemberId == model.MemberId); model.IsApproval = groupmember == null ? false : (groupmember.Role == 1 ? true : false); Db.club_post.Add(model); Db.SaveChanges(); ViewBag.message = model.IsApproval == true ? "<font color=green>Yazı başarıyla yayınlandı.</font><script typr=\"text/javascript\">setTimeout(function (){ $.OK.OpenNewPage('" + Url.Action("Index", "Home") + "'); }, 2000);</script>" : "<font color=green>Yazı başarıyla eklendi. Yöneticiler tarafından onaylandıktan sonra yayınlanacak.</font><script typr=\"text/javascript\">setTimeout(function (){ $.OK.OpenNewPage('" + Url.Action("Index", "Home") + "'); }, 2000);</script>"; } return(View(model)); }
public ActionResult ChangeApproval(int num = 0) { string result = ""; club_post post = Db.club_post.Find(num); if (post != null) { if (post.IsApproval == true) { post.IsApproval = false; result = "Yazının onayı başarıyla kaldırıldı."; } else { post.IsApproval = true; result = "Yazı başarıyla onaylandı."; } Db.SaveChanges(); } return(Content("<script type=\"text/javascript\">SuccessInfo('" + result + "');</script>")); }