public IActionResult Index() { var model = new PostsAndCategories(); model.Posts = _postRepository.GetPostByLastDates(); model.Categories = _categoryRepository.GetAll(); return(View(model)); }
public IActionResult GetPostCategoriesSubjects() { var model = new PostsAndCategories(); model.Categories = _categoryRepository.GetAll(); model.Posts = _categoryRepository.CategoriesPosts().ToList(); return(View(model)); }
public IActionResult Search(Category category, Post post) { var model = new PostsAndCategories(); model.Posts = _postRepository.SearchForPost(category, post); model.CategoriesList = _categoryRepository.GetAll().Select(c => new SelectListItem { Text = c.CategoryName, Value = c.CategoryID.ToString() }); return(View(model)); }