public ActionResult Index(int page = 1, string term = null) { log.InfoFormat("Begin Blended list Index. for:{0}", HttpContext?.Request?.Url?.AbsolutePath); int hitCount, skip = 0, take = 0; if (Limit != 0) { log.InfoFormat("Limit to:{0}", Limit); take = Limit; } if (ItemsPerPage != 0) { log.Info("ItemsPerPge is not equal to 0."); take = ItemsPerPage; skip = ItemsPerPage * (page - 1); } //log.Info("Search Index: {0}", SearchIndex.ToString()); //log.Info("Calling BlendedListHelper.GetNewsItems."); var resultSet = GetBlenedResult(out hitCount, term, skip, take); //var resultSet = GetBlenedResult(out hitCount, term, skip, take); Pagination pagination = new Pagination() { CurrentPage = page, ItemsPerPage = ItemsPerPage <= 0 ? 1 : ItemsPerPage, TotalItems = hitCount }; /*if (ItemsPerPage != 0 && hitCount > ItemsPerPage) * { * pagination = new Pagination() * { * CurrentPage = page, * ItemsPerPage = ItemsPerPage, * TotalItems = hitCount * }; * }*/ var model = new BlendedNewsListModel { ResultSet = resultSet, Pagination = pagination }; log.InfoFormat("blednew-view:{0}, model:{1}", ViewTemplate, model?.ResultSet?.Count()); return(View(ViewTemplate, model)); }
protected override void HandleUnknownAction(string actionName = "Index") { int hitCount, skip = 0, take = 0; var resultSet = GetBlenedResult(out hitCount, "", take, skip); Pagination pagination = new Pagination() { CurrentPage = 1, ItemsPerPage = ItemsPerPage <= 0 ? 1 : ItemsPerPage, TotalItems = hitCount }; var model = new BlendedNewsListModel { ResultSet = resultSet, Pagination = pagination }; log.Info("UnknownAction"); //seems like we dont have have any option for other view this.View("Index", model).ExecuteResult(ControllerContext); }
public ActionResult Index_tt(int page = 1, string term = null) { Pagination pagination = new Pagination() { CurrentPage = page, ItemsPerPage = ItemsPerPage <= 0 ? 1 : ItemsPerPage, TotalItems = 0 }; var model = new BlendedNewsListModel { ResultSet = new List <NewsResult>() { new NewsResult() { } }, Pagination = pagination }; //Providers, SearchIndex, out hitCount, Categories log.InfoFormat("Index:{0}", (new { Term = term, Provi = Providers?.Join(","), SearchIndex = SearchIndex, Categories = Categories?.Join(",") }).SerializeToString()); return(View(ViewTemplate, model)); }