Ejemplo n.º 1
0
        private ActionResult GetIndexView(ArticlesRequest request)
        {
            var hvm = new EntriesVM();

            hvm.Request = request;

            if (!request.SearchQuery.IsNullOrEmpty())
            {
                var isPro = PaymentService.IsPro(CurrentUser);
                if (!isPro)
                {
                    var numberOfSearchesAlready = FeedService.GetUserSearchesForDate(CurrentUser);
                    if (numberOfSearchesAlready >= NumberOfFreeSearches)
                    {
                        hvm.ExcededFreeSearchCount = true;
                    }
                }
                FeedService.AddSearch(request.SearchQuery, CurrentUser);
            }

            if (!hvm.ExcededFreeSearchCount)
            {
                hvm.Articles = FeedService.GetArticles(request);
            }

            SaveRequestToCookie();

            hvm.CurrentUser = CurrentUser;
            return(View("Index", hvm));
        }
Ejemplo n.º 2
0
 public static IHtmlString _GetPreviousPage(this HtmlHelper helper, EntriesVM entriesVM)
 {
     return(GetUrl(entriesVM.Page - 1));
 }
Ejemplo n.º 3
0
 public static IHtmlString _GetNextPage(this HtmlHelper helper, EntriesVM entriesVM)
 {
     return(GetUrl(entriesVM.Page + 1));
 }