// // GET: /Advise/ /// <summary> /// 考试咨讯 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult News(int?id) { string categoryCode = string.IsNullOrEmpty(Request.QueryString["CategoryCode"]) ? SystemConst.CategoryCode.News : Request.QueryString["CategoryCode"]; string order = string.IsNullOrEmpty(Request.QueryString["order"]) ? "default" : Request.QueryString["order"]; string categoryName = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == categoryCode).FirstOrDefault().Name; Pagination pagination = new Pagination(); int page = 1; if (id != null) { page = int.Parse(id.ToString()); } int size = 10; int totalCount = 0; pagination.Size = size; pagination.CurrentPageIndex = page; var articles = ArticleServices.GetArticles(categoryCode, order, page, size, out totalCount); pagination.TotalCount = totalCount; ViewBag.Order = order; ViewBag.CategoryCode = categoryCode; ViewBag.CategoryName = categoryName; ViewBag.Articles = articles; ViewBag.Pagination = pagination; return(View()); }
public ActionResult About() { var about = ArticleServices.GetArticles(SystemConst.CategoryCode.About); ViewBag.About = about; return(View()); }
private void LoadArticles() { var datasource = _articleServices.GetArticles(); metroGridSearchRes.DataSource = datasource.ToList(); VerifiedNotFoundMessage(datasource); }
// GET: Home public ActionResult Index() { //获取数据 怎么 反思 请反思 有问题 //---------------------- //测试 List <Articles> lis = ArticleServices.GetArticles(); int a = 0;//更改必须推送? return(View(lis)); }
public void TestArticleTypeCreation() { //Arrange var service = new ArticleServices(); string[] articleStuff = { "red shirt", "Shirt", "warm" }; ArticleType type = (ArticleType)Enum.Parse(typeof(ArticleType), articleStuff[1].ToString()); //Act service.CreateArticle(articleStuff[0], type, articleStuff[2]); articlesDictionary = service.GetArticles(); //Assert Assert.AreEqual(type, articlesDictionary.ElementAt(0).Value.Type); }
// // GET: /Home/ public ActionResult Index() { int totalCount = 0; string order = "latest"; ViewBag.NewsGonggao = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsGongGao, order, 1, 10, out totalCount); ViewBag.NewsExamData = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsExamData, order, 1, 10, out totalCount); ViewBag.NewsReview = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsReview, order, 1, 10, out totalCount); ViewBag.NewsScore = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsScore, order, 1, 10, out totalCount); ViewBag.Book = BookServices.GetBooks(SystemConst.CategoryCode.Book, order, 1, 10, out totalCount); ViewBag.Train = TrainServices.GetTrains(SystemConst.CategoryCode.Train, order, 1, 8, out totalCount); ViewBag.Hotel = HotelServices.GetHotels(SystemConst.CategoryCode.Hotel, order, 1, 20, out totalCount); ViewBag.Blog = BlogServices.GetBlogs(null, 0, SystemConst.CategoryCode.Blog, order, 1, 10, out totalCount); return(View()); }
public void TestGetColdArticles() { //Arrange var service = new ArticleServices(); ArticleType shirt = (ArticleType)Enum.Parse(typeof(ArticleType), "Shirt"); ArticleType pants = (ArticleType)Enum.Parse(typeof(ArticleType), "Pants"); //Act service.CreateArticle("red shirt", shirt, "warm"); service.CreateArticle("blue shirt", shirt, "cold"); service.CreateArticle("green pants", pants, "warm"); articlesDictionary = service.GetArticles(); List <string> articles = new List <string>(); articles.Add("red shirt"); articles.Add("blue shirt"); articles.Add("green pants"); //Assert Assert.AreEqual(service.getColdArticles(articles).ElementAt(0), articles.ElementAt(1)); }
//首页页面 public ActionResult Index(string type, string key, string tag) { List <Articles> Lis = ArticleServices.GetArticles(type, key, tag); return(View(Lis)); }