public ActionResult TagLink(int tagId) { var postsTags = postTagService.GetPostsByTagId(tagId); ViewBag.TagName = tagService.GetTagNameById(tagId); List <MainPostViewModel> result = new List <MainPostViewModel>(); foreach (var item in postsTags) { var post = postService.GetPostById(item.PostId); var postViewModel = mapper.Map <MainPostViewModel>(post); result.Add(postViewModel); } foreach (var item in result) { var fullname = profileService.FindFullName(item.UserId); item.FullName = new FullNameViewModel { FirstName = fullname.FirstName, LastName = fullname.LastName }; item.CommentsCount = commentService.GetCommentsCount(item.Id); } return(View(result)); }