public ActionResult Detail(int id, string seo, int page) { var post = Db.club_post.Find(id); int memberid = (int)Session["memberid"]; var groupmember = post.GroupId == null || memberid == 0 ? null : Db.club_groupmember.SingleOrDefault(x => x.MemberId == memberid && x.GroupId == post.GroupId && x.Role == 1); if (post == null || (post.IsApproval == false && groupmember == null) || post.CategoryId != null ? (post.club_category.IsApproval == false) : post.club_group == null) { return(HttpNotFound()); } else if (post.Seo != seo) { return(RedirectToAction("Detail", "Post", new { id = id, seo = post.Seo, page = 1 })); } else { int take = 10; int skip = take * (page - 1); var comments = post.club_comments.Where(x => x.IsApproval == true).OrderByDescending(x => x.WritingDate); post.ViewsCount++; Db.SaveChanges(); ViewBag.Title = post.Title; ViewBag.comments = comments.Skip(skip).Take(take).ToList(); ViewBag.commentcount = comments.Count(); return(View(post)); } }
public ActionResult Create(club_member member) { if (ModelState.IsValid) { Db.club_member.Add(member); Db.SaveChanges(); return(RedirectToAction("Index")); } return(View(member)); }
public ActionResult Create(club_page page) { if (ModelState.IsValid) { Db.club_page.Add(page); Db.SaveChanges(); return(RedirectToAction("index")); } return(View(page)); }
public ActionResult Create(club_config config) { if (ModelState.IsValid) { Db.club_config.Add(config); Db.SaveChanges(); return(RedirectToAction("Index")); } return(View(config)); }
public ActionResult Create(club_notice notice) { if (ModelState.IsValid) { notice.WritingDate = DateTime.Now; Db.club_notice.Add(notice); Db.SaveChanges(); return(RedirectToAction("index")); } return(View(notice)); }
public ActionResult Create(club_menulink menulink) { if (ModelState.IsValid) { Db.club_menulink.Add(menulink); Db.SaveChanges(); return(RedirectToAction("index")); } return(View(menulink)); }
public ActionResult Create(club_category category) { if (ModelState.IsValid) { category.Seo = OK.ConvertSeo(category.Name); Db.club_category.Add(category); Db.SaveChanges(); return(RedirectToAction("index")); } return(View(category)); }
public ActionResult Create(club_postcomment comment) { if (ModelState.IsValid) { comment.MemberId = (int)Session["memberid"]; comment.WritingDate = DateTime.Now; Db.club_postcomment.Add(comment); Db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PostId = new SelectList(Db.club_post, "Id", "Title"); return(View(comment)); }
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 Create(club_group group) { if (ModelState.IsValid) { group.Seo = OK.ConvertSeo(group.Name); Db.club_group.Add(group); Db.SaveChanges(); return(RedirectToAction("Index")); } return(View(group)); }
public ActionResult ChangePostApproval() { int id = Convert.ToInt32(Request.Form["id"]); var post = Db.club_post.Find(id); if (post != null) { int memberid = (int)Session["memberid"]; var control = Db.club_groupmember.SingleOrDefault(x => x.MemberId == memberid && x.GroupId == post.GroupId && x.Role == 1); if (control != null) { post.IsApproval = !post.IsApproval; Db.SaveChanges(); } } return(Content("")); }