/* * public ActionResult Blog() * { * * int currentPage = Convert.ToInt32(Request.QueryString["currentPage"]); * UserManager userManager = new UserManager(); * //UserModels queryUserModels = new UserModels(); * //queryUserModels.Id = "028636db-f6b6-4640-9001-341931a799a2"; * //queryUserModels.UserName = "******"; * //ViewBag.UserModelsList = userManager.findUserList(queryUserModels); * ViewBag.UserModelsList = userManager.findAllUserList(); * ViewBag.Message = "在这里写下我的想法"; * return View(); * * * ArticlesModels articlesModels = new ArticlesModels(); * articlesModels.CurrentPage = 0; * articlesModels.PageSize = 15; * ArticlesManager articlesManager = new ArticlesManager(); * PageResultModels<ArticlesModels> pageResultModels = articlesManager.findListByPage(articlesModels); * ViewBag.PageResultModels = pageResultModels; * ViewBag.Message = "在这里写下我的想法"; * return View(); * }*/ public ActionResult Blog(int?currentPage, int?articleTypesId) { ArticlesQueryModels articlesQueryModels = new ArticlesQueryModels(); articlesQueryModels.CurrentPage = currentPage == null ? 1 : Convert.ToInt32(currentPage); articlesQueryModels.ArticleTypesId = articleTypesId == null ? 0 : Convert.ToInt32(articleTypesId); articlesQueryModels.PageSize = 15; ArticlesManager articlesManager = new ArticlesManager(); PageResultModels <ArticlesModels> pageResultModels = articlesManager.findListByPage(articlesQueryModels); ViewBag.PageResultModels = pageResultModels; if (articlesQueryModels.ArticleTypesId == 0) { ActicleTypeModels acticleTypeModels = new ActicleTypeModels(); acticleTypeModels.Name = "全部"; acticleTypeModels.Id = 0; ViewBag.ActicleTypeModels = acticleTypeModels; } else { ActicleTypeManager acticleTypeManager = new ActicleTypeManager(); ViewBag.ActicleTypeModels = acticleTypeManager.findById(articlesQueryModels.ArticleTypesId); } ViewBag.Message = "在这里写下我的想法"; return(View()); }
public ActionResult _Layout() { ActicleTypeManager acticleTypeManager = new ActicleTypeManager(); List <ActicleTypeModels> list = acticleTypeManager.findList(); ViewBag.ActicleTypeModelsList = list; return(PartialView()); }