Ejemplo n.º 1
0
        public PartialViewResult RightSearchWindow()
        {
            var categories = _categoryRepo.GetAll();
            CategoriesWithLastPosts model = new CategoriesWithLastPosts();

            model.Categories = categories;
            var recentPosts = _postRepo.GetRecentPosts(_settingsRepo.GetSettings().RecentPosts);

            model.RecentPosts = recentPosts;
            return(PartialView("_RightSearchWindow", model));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Index(int?page)
        {
            int currentPage           = page ?? 1;
            int quantityOfPostsOnPage = _settingsRepo.GetSettings().PostsOnSite;

            try
            {
                var posts = await _postRepo.GetAllPostsAsync();

                return(View(posts.ToPagedList <Post>(currentPage, quantityOfPostsOnPage)));
            } catch (Exception e)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> GetPostsByPhrase(string phrase, int?page)
        {
            int currentPage           = page ?? 1;
            int quantityOfPostsOnPage = _settingsRepo.GetSettings().PostsOnSite;

            try
            {
                var posts = await _postRepo.GetPostsByPhrase(phrase);

                ViewBag.Phrase = phrase;
                return(View("ByPhrase", posts.ToPagedList <Post>(currentPage, quantityOfPostsOnPage)));
            } catch (Exception e)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Ejemplo n.º 4
0
        public ActionResult ManageGlobalSettings()
        {
            var model = _settingsRepo.GetSettings();

            return(View(model));
        }