protected void loadCommonData() { Category category = new Category(); Tag tag = new Tag(); ModelList<Category> categories = category.getBy<Category>(); ModelList<Tag> tags = tag.getBy<Tag>(); ViewData["categories"] = categories; ViewData["tags"] = tags; }
public ActionResult Category(string id) { this.loadCommonData(); Category category = new Category(); Post post = new Post(); if(id != "") { category.Url = id; post.Categories = new ModelList<Category>(); post.Categories.Add(category); } ModelList<Post> posts = post.getBy<Post>(true); ViewData["posts"] = posts; return View(); }