详解linux下的.net/mvc/cms程序结构

  public ActionResult Category(string pagename)

  {

  var model = new PostListModel();

  CategoryInfo cate = _categoryService.GetCategory(pagename);

  model.Category = cate;

  if (cate != null)

  {

  int categoryId = cate.CategoryId;

  model.MetaKeywords = cate.CateName;

  model.MetaDescription = cate.Description;

  ViewBag.Title = cate.CateName;

  model.Url = ConfigHelper.SiteUrl + "category/" + Jqpress.Framework.Utils.StringHelper.SqlEncode(pagename) + "/page/{0}";

  const int pageSize = 10;

  int count = 0;

  int pageIndex = PressRequest.GetInt("page", 1);

  int cateid = PressRequest.GetQueryInt("cateid", -1);

  int tagid = PressRequest.GetQueryInt("tagid", -1);

  if (cateid > 0)

  pageIndex = pageIndex + 1;

  var cateids =categoryId+","+ _categoryService.GetCategoryList().FindAll(c => c.ParentId == categoryId).Aggregate(string.Empty, (current, t) => current + (t.CategoryId + ",")).TrimEnd(',');

  var postlist = _postService.GetPostPageList(pageSize, pageIndex, out count, cateids.TrimEnd(','), tagid, -1, -1, -1, -1, -1,-1, "", "", "");

  model.PageList.LoadPagedList(postlist);

  model.PostList = (List)postlist;

  }

  model.IsDefault = 0;

  return View(model.Category.ViewName,model);

  }