コード例 #1
0
        }//detach file

        /// <summary>
        /// star a topic
        /// </summary>
        /// <param name="id"></param>
        /// <param name="star"></param>
        /// <returns></returns>
        public JsonResult StarTopic(Guid id, bool star)
        {
            var msg = default(Msg);

            msg = star ? Topic.Star(id, CurrentUserName) : TopicElected.Delete(id);
            return(Json(msg));
        }
コード例 #2
0
        public ActionResult ListTopic(bool published = false, string term = "")
        {
            var vm = CreateViewData <VMCampTopicList>();

            term         = (term ?? "").ToLower();
            vm.Published = published;
            vm.Term      = term;
            //get group data
            vm.GroupList = Group.ListAllData();
            vm.TopicList = new List <VMCampTopicEdit>();
            //get topic data
            Topic.ListAll(published, term, items => items.ForEach(x => vm.TopicList.Add(new VMCampTopicEdit
            {
                Id         = x.Id,
                Title      = x.Title,
                UserName   = x.User.Name,
                Grade      = x.Grade,
                CreateAt   = x.CreatedAt,
                CntComment = x.Comments.Count,
                GroupsTxt  = String.Join(",", x.Groups.ToList().ConvertAll(y => y.Name)),
                TagsTxt    = String.Join(",", x.Tags.ToList().ConvertAll(z => z.Name)),
                Starred    = TopicElected.Exists(x.Id)
            })));
            return(View(vm));
        }