public ActionResult Index(string tag = "")
        {
            //TODO: Implement the corresponding call to get all items or filtered by tag.
            //Return an instance of ListingViewModel.
            var results = string.IsNullOrEmpty(tag)
                ? KnowledgeQuery.GetAll()
                : KnowledgeQuery.GetByFilter(x => x.Tags.Contains(tag));

            ListingViewModel model = new ListingViewModel()
            {
                Questions = mapper.Map <List <QuestionAndAnswerItemModel> >(results),
                Tag       = tag
            };

            return(View("Index", model));
        }
示例#2
0
        public static List <Entities.TagItem> Process(Services.IQueryService <Entities.KnowledgeBaseItem> knowledgeService, out int tagMaxCount)
        {
            var sourceItems = knowledgeService.GetAll();

            return(Process(sourceItems, out tagMaxCount));
        }