示例#1
0
        public ActionResult ModifyTopic(string activenavitem, string topicid, string commentid)
        {
            UserAuth();
            var tempnavlist = new List <string>();

            tempnavlist.AddRange(new string[] { TopicBelongType.IModify, TopicBelongType.IAssign, TopicBelongType.IRelated, TopicBelongType.Completed });
            ViewBag.NavList = tempnavlist;

            if (!string.IsNullOrEmpty(topicid) && !string.IsNullOrEmpty(commentid))
            {
                ViewBag.activenavitem = activenavitem;
                ViewBag.topicid       = topicid;
                ViewBag.commentid     = commentid;
                var commentlist = TopicCommentVM.RetrieveComment(topicid, commentid);
                if (commentlist.Count > 0)
                {
                    ViewBag.tcontent = commentlist[0].commentcontent;
                }
                else
                {
                    return(RedirectToAction("Home", "CoWork"));
                }
            }
            else if (!string.IsNullOrEmpty(topicid))
            {
                ViewBag.activenavitem = activenavitem;
                ViewBag.topicid       = topicid;
                ViewBag.commentid     = "";
                var topiclist = CoTopicVM.RetrieveTopic(topicid);
                if (topiclist.Count > 0)
                {
                    ViewBag.tcontent = topiclist[0].topiccontent;
                }
                else
                {
                    return(RedirectToAction("Home", "CoWork"));
                }
            }
            else
            {
                return(RedirectToAction("Home", "CoWork"));
            }

            return(View());
        }
示例#2
0
        public ActionResult ModifyTopicPost()
        {
            var activenavitem = Request.Form["navid"];
            var activetopicid = Request.Form["topicid"];
            var commentid     = Request.Form["commentid"];
            var tcontent      = SeverHtmlDecode.Decode(this, Request.Form["JobTopicEditor"]);

            if (!string.IsNullOrEmpty(activetopicid) && !string.IsNullOrEmpty(commentid))
            {
                TopicCommentVM.UpdateComment(commentid, tcontent);
            }
            else
            {
                CoTopicVM.UpdateTopic(activetopicid, tcontent);
            }

            CoTopicVM.UpdateTopicIsRead(activetopicid, false);

            var routedict = new RouteValueDictionary();

            routedict.Add("activenavitem", activenavitem);
            routedict.Add("topicid", activetopicid);
            return(RedirectToAction("Home", "CoWork", routedict));
        }
示例#3
0
        public ActionResult NewTopicComment()
        {
            UserAuth();
            var activetopicid  = Request.Form["activetopicid"];
            var activenavitem  = Request.Form["activenav"];
            var commentcontent = SeverHtmlDecode.Decode(this, Request.Form["CommentEditor"]);

            if (!string.IsNullOrEmpty(commentcontent))
            {
                var commenttime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                var commentid   = CoTopicVM.GetUniqKey();

                TopicCommentVM.AddComment(activetopicid, commentid, commentcontent, ViewBag.username, commenttime);
                CoTopicVM.UpdateTopicIsRead(activetopicid, false);
            }



            var routedict = new RouteValueDictionary();

            routedict.Add("activenavitem", activenavitem);
            routedict.Add("topicid", activetopicid);
            return(RedirectToAction("Home", "CoWork", routedict));
        }
示例#4
0
 public ActionResult Post(int Id)
 {
     TopicCommentVM toView = new TopicCommentVM();
     toView.topic = blogData.GetTopic(Id);
     return View(toView);
 }
示例#5
0
 public ActionResult Post(TopicCommentVM newCom)
 {
     if (newCom.CommentToAdd.Comment.AuthorName != null && newCom.CommentToAdd.Comment.CommentText != null)
     {
         TopicComment toAdd = new TopicComment();
         toAdd.Comment = newCom.CommentToAdd.Comment;
         blogData.SetCommentOnTopic(toAdd, newCom.topic.TopicId);
         return RedirectToAction("Post");
     }
     else
     {
         return RedirectToAction("Post");
     }
 }