public GameModeController() { m_MainMenu = new MainMenu(this); m_cmpPage = new CmpPage(this); m_Choosing = new Choosing(this); m_SelPage = new SelPage(this); m_Training = new Training(this); m_Test2 = new Test_2(this); MainWindow.last.EYE.Navigate(m_MainMenu); }
//图书分页 public BookPage ShowPage(string modes) { SelPage mode = JsonConvert.DeserializeObject <SelPage>(modes); var list = GetAllInfo().ToList();; //mode.PageIndex = 1; //mode.PageSize = 3; //作者查询 if (mode.Authorname != null) { list = list.Where(m => m.Aname.Contains(mode.Authorname)).ToList(); } else { list = GetAllInfo().ToList(); } //书名查询 if (mode.Bookname != null) { list = list.Where(m => m.Title.Contains(mode.Bookname)).ToList(); } else { list = GetAllInfo().ToList(); } //出版社查询 if (mode.Chu != null) { list = list.Where(m => m.Publish.Contains(mode.Chu)).ToList(); } else { list = GetAllInfo().ToList(); } //分类查询 if (mode.Typese != null) { list = list.Where(m => m.NclassId.Contains(mode.Typese)).ToList(); } else { list = GetAllInfo().ToList(); } if (mode.AseInfo == "ase") { list = list.OrderBy(m => m.Price).ToList(); } if (mode.DesOut == "des") { list = list.OrderByDescending(m => m.SaledNum).ToList(); } //总条数 var totalcount = list.Count(); //总页数 var allPage = totalcount / mode.PageSize + (totalcount % mode.PageSize > 0 ? 1 : 0); list = list.Skip(mode.PageSize * (mode.PageIndex - 1)).Take(mode.PageSize).ToList(); BookPage bok = new BookPage(); bok.BooksInfoAlls = list; bok.TotalCount = totalcount; bok.TotalPage = allPage; return(bok); }