示例#1
0
        public IEnumerable <TextbookView> GetTextbooksByName(string name, string isbn)
        {
            IEnumerable <Textbook> models = new List <Textbook>();

            if (string.IsNullOrWhiteSpace(name))
            {
                if (string.IsNullOrWhiteSpace(isbn))
                {
                }
                else
                {
                    models = _textbookRepo.Find(t => t.Isbn.Contains(isbn));
                }
            }
            else
            {
                models = _textbookRepo.Find(t => t.Name.Contains(name));
            }
            return(_adapter.Adapt <TextbookView>(models));
        }
示例#2
0
        public IEnumerable <TextbookForQueryView> GetByName(string textbookName, string isbn)
        {
            IEnumerable <Textbook> books = new List <Textbook>();

            if (string.IsNullOrWhiteSpace(textbookName))
            {
                if (string.IsNullOrWhiteSpace(isbn))
                {
                    //无数据返回
                }
                else
                {
                    books = _bookRepo.Find(t => t.Isbn.Contains(isbn));
                }
            }
            else
            {
                books = _bookRepo.Find(t => t.Name.Contains(textbookName));
            }

            books = books.OrderBy(t => t.Name);

            return(_adapter.Adapt <TextbookForQueryView>(books));
        }