public ActionResult ViewTopic(long id, long catid, VTopicModel vt) { VTopicModel viewTop = new VTopicModel(); viewTop.Vtp = (from ft in db.ForumTopics join me in db.Mems on ft.memsid equals me.memsid where ft.TopicId == id && ft.IsApproved == "Y" select new ViewTopicModel { TopicId = ft.TopicId, TopicDesc = ft.TopicDesc, TopicTitle = ft.TopicTitle, fname = me.fname, Photo = me.gimg, SubCatId = ft.SubCatId, memsid = ft.memsid, UpdateCandiId = ft.UpdateCandiId.ToString(), UpdateCandiName = ft.UpdateCandiName, UpdateDate = ft.UpdateDate.ToString(), StartDate = ft.StartDate.ToString(), LastAnsId = db.ForumTopics.Where(c => c.memsid == me.memsid).Count(), TotalThread = db.ForumSubCategories.Where(c => c.SubCatId == ft.SubCatId).Count(), TotalReplay = db.ForumTopicAnswers.Where(c => c.TopicId == ft.TopicId).Count(), }).FirstOrDefault(); long memid = Convert.ToInt32(Request.Cookies["memsid"].Value); string fname = Request.Cookies["fname"].Value; if (vt.insAns.TopicAns != null) { if (ModelState.IsValid) { commonFun rpb = new commonFun(); string tpans = string.Empty; tpans = rpb.ReplaceBadWords(vt.insAns.TopicAns); int i = db.forumInsertAnswer(id, tpans, memid, System.DateTime.Now, fname); if (i > 0) { ViewBag.Success = true; ViewBag.Message = "Reply Posted Successfully Queued For Approval"; return View(viewTop); } else { ViewBag.Success = false; ViewBag.Message = "Unable to Post"; return View(viewTop); } } } else { ViewBag.Success = false; ViewBag.Message = "Unable to Post"; return View(viewTop); } return View(viewTop); }
public ActionResult ViewTopic(long id, long catid) { VTopicModel viewTop = new VTopicModel(); viewTop.Vtp = (from ft in db.ForumTopics join me in db.Mems on ft.memsid equals me.memsid where ft.TopicId == id && ft.IsApproved == "Y" select new ViewTopicModel { TopicId = ft.TopicId, TopicDesc = ft.TopicDesc, TopicTitle = ft.TopicTitle, fname = me.fname, Photo = me.gimg, SubCatId = ft.SubCatId, memsid = ft.memsid, UpdateCandiId = ft.UpdateCandiId.ToString(), UpdateCandiName = ft.UpdateCandiName, UpdateDate = ft.UpdateDate.ToString(), StartDate = ft.StartDate.ToString(), LastAnsId = db.ForumTopics.Where(c => c.memsid == me.memsid).Count(), TotalThread = db.ForumSubCategories.Where(c => c.SubCatId == ft.SubCatId).Count(), TotalReplay = db.ForumTopicAnswers.Where(c => c.TopicId == ft.TopicId).Count(), }).FirstOrDefault(); viewTop.TpAns = (from fta in db.ForumTopicAnswers join me in db.Mems on fta.memsid equals me.memsid where fta.TopicId == id && fta.IsApproved == "Y" orderby fta.AnsDate select new TopicAnsModel { TopicAns = fta.TopicAns, TopicId = fta.TopicId, AnsId = fta.AnsId, gimg = me.gimg, fname = me.fname, memsid = fta.memsid, AnsDate = fta.AnsDate.ToString() }).ToList(); return View(viewTop); }