public ActionResult Category(string categoryName, BlogModel model) { ActionResult result = null; if (string.IsNullOrEmpty(categoryName)) { model = this.GetCategoryModel(); } else { model = this.GetCategoryModel(categoryName, model); } if (result == null) { result = View(model); } return result; }
private BlogModel GetIndexModel() { BlogModel model = new BlogModel(); model.FeedId = string.Empty; model.FeedFormatter = this.ProviderSyndication.GetInfoWithNoItems(); model.FeedFilter = new DataFilterSyndication() { Page = 0, PageSize = (int)VsixMvcAppResult.Models.Enumerations.PageSizesAvailable.RowsPerPage10 }; model.FeedItems = this.ProviderSyndication.GetLast(model.FeedFilter); model.BaseViewModelInfo.Title = model.FeedFormatter.Feed.Title.Text; return model; }
private BlogModel GetIndexModelByTitle(string title) { BlogModel model = new BlogModel(); model.FeedId = string.Empty; model.FeedFormatter = this.ProviderSyndication.GetInfoWithNoItems(); model.FeedFilter = new DataFilterSyndication() { Uri = title, Page = 0, PageSize = (int)VsixMvcAppResult.Models.Enumerations.PageSizesAvailable.RowsPerPage10 }; model.FeedItems = this.ProviderSyndication.GetByTitle(model.FeedFilter); model.BaseViewModelInfo.Title = model.FeedFormatter.Feed.Title.Text; if (model.FeedItems.TotalRows > 0) { model.BaseViewModelInfo.Title = model.FeedItems.Data.First().Item.Title.Text; } return model; }
private BlogModel GetCategoryModel(string categoryName, BlogModel model) { model.FeedId = categoryName; if (this.RequestType() == HttpVerbs.Get) { model = new BlogModel() { FeedId = categoryName, FeedFilter = new DataFilterSyndication() { CategoryName = categoryName, Page = 0, PageSize = (int)VsixMvcAppResult.Models.Enumerations.PageSizesAvailable.RowsPerPage10 } }; } else { if (WebGrid<SyndicationItemFormatter, BlogModel, DataFilterSyndication>.IsWebGridEvent()) { this.ModelState.Clear(); model.FeedFilter = (DataFilterSyndication)WebGrid<SyndicationItemFormatter, BlogModel, DataFilterSyndication>.GetDataFilterFromPost(); } } if (!string.IsNullOrEmpty(categoryName)) { model.FeedItems = this.ProviderSyndication.GetByCategory(model.FeedFilter); model.FeedFormatter = this.ProviderSyndication.GetInfoWithNoItems(); model.BaseViewModelInfo.Title = string.Format("{0} - {1}", categoryName, model.FeedFormatter.Feed.Title.Text); } return model; }