public async Task <ActionResult> Index(string id) { //Get Content var content = await _repo.GetContentAsync(id); if (content == null) { return(View("Missing")); } //for landing pages, get the top items for the list if (content.ContentType == Models.ContentType.ListLanding) { var listItems = await _repo.GetListItemsWithSummaryAsync(content.Id); ((Models.ListLandingContent)content).Items = listItems; } //for media galleries, setup the model with the base url for the storage provider if (content.ContentType == Models.ContentType.MediaGallery) { ((Models.MediaGalleryContent)content).BaseUrl = _media.MediaBaseAddress; } //Create view based on content type return(View(content.ContentType.ToString(), content)); }
public async Task <ActionResult> Index() { // get the banner content if there is any Models.BannerContent banner = null; try { banner = await _repo.GetContentAsync(Config.Constants.KEY_BANNER_CONTENT) as Models.BannerContent; } catch { //if we can't load, let the user know to make sure and configure ViewBag.ErrorMessage = "Error loading data. Make sure you have deployed your resources to Azure and configured the app accordingly."; } if (banner != null && banner.Expiration > System.DateTime.UtcNow) { return(View(banner)); } else { return(View()); } }