public ActionResult Thread(long?id, long page = 0, int capacity = 15) { if (id == null) { return(View("NotFound")); } ThreadPostsModel posts = new ThreadPostsModel { Thread = ThreadDAO.Select(id) }; posts.Creator = AccountDAO.Select(posts.Thread.Account); posts.Post = PostDAO.SelectFirstPostByThread(posts.Creator.Id.Value, posts.Thread.Id.Value); var post = AccountPostDAO.SelectItemsByThread(id.Value).AsEnumerable(); posts.Posts = post.Skip(capacity * (int)page).Take(capacity); posts.Pages = (post.Count() - 1) / capacity; posts.Page = page; ThreadDAO.ViewsCount(id.Value); return(View(posts)); }