private async Task <String> GetRelatedContentsHtml(int categoryId, string contentType, int excludedContentId, string designName, int take, int imageWidth, int imageHeight) { string returnHtml; var categoryTask = CategoryService.GetCategoryAsync(categoryId); if (take == 0 && contentType.Equals(StoreConstants.NewsType)) { take = GetSettingValueInt("RelatedNews_ItemsNumber", 5); } else if (take == 0 && contentType.Equals(StoreConstants.BlogsType)) { take = GetSettingValueInt("RelatedBlogs_ItemsNumber", 5); } var relatedContentsTask = ContentService.GetContentByTypeAndCategoryIdAsync(StoreId, contentType, categoryId, take, excludedContentId); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); ContentService2.ImageWidth = imageWidth; ContentService2.ImageHeight = imageHeight; await Task.WhenAll(pageDesignTask, relatedContentsTask, categoryTask); var contents = relatedContentsTask.Result; var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; var pageOutput = ContentService2.GetRelatedContentsPartial(category, contents, pageDesign, contentType); returnHtml = pageOutput.PageOutputText; return(returnHtml); }
private async Task <String> GetContentsByContentTypeHtml(int page, int pageSize, string designName, int categoryId, int imageWidth, int imageHeight, string type, string contentType) { string returnHtml; var catId = categoryId == 0 ? (int?)null : categoryId; ContentService2.ImageWidth = imageWidth; ContentService2.ImageHeight = imageHeight; Task <List <Content> > contentsTask = ContentService.GetContentsByContentKeywordAsync(StoreId, catId, type, page, pageSize, true, contentType); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, type, true); await Task.WhenAll(pageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; var pageOuput = ContentService2.GetContentsByContentType(contents, categories, pageDesign, type); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
public virtual async Task <ActionResult> Index(int page = 1, String search = "", int?categoryId = null) { try { if (!IsModulActive(Type)) { Logger.Trace("Navigation Modul is not active:" + Type); return(HttpNotFound("Not Found")); } var newsPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName); var pageSize = GetSettingValueInt(Type + "IndexPageSize", StoreConstants.DefaultPageSize); var contentsTask = ContentService.GetContentsCategoryIdAsync(StoreId, categoryId, Type, true, page, pageSize, search); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, Type, true); var settings = GetStoreSettings(); ContentService2.ImageWidth = GetSettingValueInt(Type + "Index_ImageWidth", 50); ContentService2.ImageHeight = GetSettingValueInt(Type + "Index_ImageHeight", 50); await Task.WhenAll(newsPageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = newsPageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingIndexPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = ContentService2.GetContentsIndexPage(contents, pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = this.PageTitle; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, Type + "Controller:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
public virtual ActionResult Blog(String id) { if (!IsModulActive(ContentType)) { return(HttpNotFound("Not Found")); } ContentDetailViewModel resultModel = ContentService2.GetContentDetail(id, ContentType); return(View(resultModel)); }
public virtual ActionResult Index(int page = 1) { if (!IsModulActive(ContentType)) { return(HttpNotFound("Not Found")); } ContentsViewModel resultModel = ContentService2.GetContentIndexPage(page, ContentType); return(View(resultModel)); }
// // GET: /Blogs/ public virtual async Task <ActionResult> Detail(String id = "") { try { if (!IsModulActive(Type)) { Logger.Trace("Navigation Modul is not active:" + Type); return(HttpNotFound("Not Found")); } int newsId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingDetailPageName); var contentTask = ContentService.GetContentByIdAsync(newsId); var categoryTask = CategoryService.GetCategoryByContentIdAsync(StoreId, newsId); var settings = GetStoreSettings(); ContentService2.ImageWidth = GetSettingValueInt(Type + "Detail_ImageWidth", 50); ContentService2.ImageHeight = GetSettingValueInt(Type + "Detail_ImageHeight", 50); await Task.WhenAll(pageDesignTask, contentTask, categoryTask); var content = contentTask.Result; var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + PageDesingDetailPageName); } var dic = ContentService2.GetContentDetailPage(content, pageDesign, category, Type); dic.StoreSettings = settings; dic.MyStore = this.MyStore; dic.PageTitle = content.Name; return(View(dic)); } catch (Exception ex) { Logger.Error(ex, Type + "Controller" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> News(int take = 15, int description = 250, int imageHeight = 50, int imageWidth = 50) { var contentsTask = ContentService.GetContentByTypeAsync(StoreId, take, true, StoreConstants.NewsType); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, StoreConstants.NewsType, true); var storeTask = StoreService.GetStoreAsync(StoreId); await Task.WhenAll(storeTask, contentsTask, categoriesTask); var store = storeTask.Result; var content = contentsTask.Result; var categories = categoriesTask.Result; var feed = ContentService2.GetContentsRssFeed(store, content, categories, description, StoreConstants.NewsType); ContentService2.ImageWidth = imageWidth; ContentService2.ImageHeight = imageHeight; var comment = new StringBuilder(); comment.AppendLine("Take=Number of rss item; Default value is 10 "); comment.AppendLine("Description=The length of description text.Default value is 300 "); return(new FeedResult(feed, comment)); }
public ActionResult Blogs(int take = 15, int description = 250, int imageHeight = 50, int imageWidth = 50) { return(ContentService2.GetContentRss(take, description, imageHeight, imageWidth, StoreConstants.BlogsType)); }