Skip to content

Instantly share code, notes, and snippets.

@casper-rasmussen
Last active April 3, 2016 18:08
Show Gist options
  • Save casper-rasmussen/a61d3410d33322d2d6cef656c22b77c7 to your computer and use it in GitHub Desktop.
Save casper-rasmussen/a61d3410d33322d2d6cef656c22b77c7 to your computer and use it in GitHub Desktop.
[TemplateDescriptor(
Inherited = true,
AvailableWithoutTag = true,
Default = true,
ModelType = typeof(FormBlockType),
TemplateTypeCategory = TemplateTypeCategories.MvcPartialController)]
public class FormBlockController : BlockController<FormBlockType>
{
private readonly IFormViewModelBuilder _viewModelBuilder;
public FormBlockController(IFormViewModelBuilder viewModelBuilder)
{
this._viewModelBuilder = viewModelBuilder;
}
public override ActionResult Index(FormBlockType currentContent)
{
FormBlockViewModel viewModel = new FormBlockViewModel();
viewModel.Form = this._viewModelBuilder.Build(currentContent.Form, ContentLanguage.PreferredCulture);
//Use Partial view
return PartialView(viewModel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment