/// <summary> /// Method that grabs all the posts when the user clicks on a category link. /// </summary> /// <param name="categoryId">the identification number of a category of posts</param> /// <returns>The Post Index View</returns> public ActionResult GetItemRequestPostsForCategory(int categoryId) { PostModel model = new PostModel(); model.UserLoginName = claimsHelper.GetUserNameFromClaim((ClaimsIdentity)User.Identity); GetAllItemRequestPostsForCategoryQuery postQuery = new GetAllItemRequestPostsForCategoryQuery(new Category(categoryId)); model.AllPostsForCategory = commandBus.ProcessQuery(postQuery); model.CategoryTitle = Enumeration.TryFindById <CategoryEnum>(categoryId).DisplayValue; return(View(ViewNames.PostIndex, model)); }
/// <summary> /// Handler for the Get All Looking For Posts For Category query /// </summary> /// <param name="query">the data for the query</param> /// <returns>a collection of previews for all 'looking for' items in a cetegory.</returns> public IEnumerable <PostPreview> Handle(GetAllItemRequestPostsForCategoryQuery query) { return(postRepository.GetAllItemRequestPostsForCategory(query.Category)); }