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)); }
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)); } }
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)); } }
public ActionResult ManageGlobalSettings() { var model = _settingsRepo.GetSettings(); return(View(model)); }