Does MVC UmbracoTemplateView<TModel> support controllers that return IContent?
Hi All
We're plugging in MVC5 into Umbraco 7.
Just to check my understanding, I have a RenderModel that is returning IPublishedContent, and it doesn't show unpublished items in Preview mode, correct?
```C#
List
if (@Model != null && @Model.Content != null)
{
heroContent = @Model.Content.Children
.Where(c => c.DocumentTypeAlias.Equals("HomePageHero", StringComparison.OrdinalIgnoreCase))
.Where(x => x.IsVisible() || @UmbracoContext.InPreviewMode) // <-- this has no effect?
.ToList();
}
else
{
// this so that it can be rendered in the editor without error
heroContent = new List<IPublishedContent>();
}
```
If I create my own controller (returning IContent), it works OK
// constructor logic here AGGHHH no convention
var context = new MyUmbracoContext(@UmbracoContext.InPreviewMode);
var contentService = new MyContentService(context, @UmbracoContext.Application.Services.ContentService);
var mediaService = new MyMediaService(new mediaService);
var controller = new HeroPromoController(mediaService, contentService);
var heroContent = controller.GetHeroMediaItems(@Model.Content.Id);
Does MVC UmbracoTemplateView<TModel> support controllers that return IContent?
Hi All
We're plugging in MVC5 into Umbraco 7.
Just to check my understanding, I have a RenderModel that is returning IPublishedContent, and it doesn't show unpublished items in Preview mode, correct?
```C# List
```
If I create my own controller (returning IContent), it works OK
```C# @inherits UmbracoTemplatePage @using My.UmbracoServices @using My.UmbracoServices.Controllers @{
}
```
Q. Is there a base view
is working on a reply...