Пример #1
0
		private void FillDropDowns(IndexViewModel viewModel)
		{
			viewModel.Filter.PublishedSelectList = new[] {
				new SelectListItem { Value = "1", Text = "Yes" }
				,new SelectListItem { Value = "2", Text = "No" }
			};

			var list = blogRepository.ToList();
			viewModel.Filter.BlogSelectList = list.ToSelectList(b => b.ID, b => b.Title);
		}
Пример #2
0
		public ActionResult Index(IndexViewModel viewModel)
		{
			FillDropDowns(viewModel);

			var expression = viewModel.Filter.GetExpression();
			var gridBuilder = new GridBuilder(viewModel.AllPosts);

			var posts = postRepository.Where(expression).ToList();

			gridBuilder.Populate(posts);

			return View(viewModel);
		}