コード例 #1
0
        public async Task <MessageModel <List <QuestionBankTree> > > TitlesByTypeName(string typeName = "")
        {
            var typeId = (await _questionTypeRepository.Query(d => d.Name != null && d.Name.ToLower() == typeName.ToLower() && !d.IsDeleted)).ToList().FirstOrDefault()?.Id;
            List <QuestionBankTree> blogList = new List <QuestionBankTree>();

            if (typeId > 0)
            {
                blogList = (await _questionBankRepository.Query(d => !d.IsDeleted && d.TypeId == typeId)).Select(d => new QuestionBankTree()
                {
                    Id    = d.Id,
                    Title = d.Title
                }).ToList();
            }


            return(new MessageModel <List <QuestionBankTree> >()
            {
                msg = "获取成功",
                success = true,
                response = blogList
            });
        }