MyStory.Controllers.TagController.Index C# (CSharp) Method

Index() public method

public Index ( string tag = null, int page = 1 ) : System.Web.Mvc.ActionResult
tag string
page int
return System.Web.Mvc.ActionResult
        public ActionResult Index(string tag=null, int page=1)
        {
            ViewBag.TagText = tag;

            int perPage = page == 1 ? 20 : 10;

            var posts = new PostQuery()
                        {
                            CurrentPageNumber = page,
                            PostsPerPage = perPage,
                            Tag=tag
                        }
                        .GetQuery(DbContext)
                        .ToList();

            var postListViewModel = Mapper.Map<List<Post>, List<PostListViewModel>>(posts);

            return View("Index", postListViewModel);
        }