Here is my constructor code (below) - also when I change the Layout setting in my .cshtml file, it is now throwing the same error in your example. So my question is what is the correct setting for Layout?
@{
Layout = "~/Administration/Views/Shared/_AdminLayout.cshtml";
}
Source for SocialMediaController:
using System.Web.Mvc;
using EbpCustom.Plugin.SocialMedia.Models;
using Nop.Services.Configuration;
using Nop.Web.Framework.Controllers;
using Nop.Services.Localization;
using Nop.Admin.Controllers;
namespace EbpCustom.Plugin.SocialMedia.Controllers
{
public class SocialMediaController : Controller
{
private readonly ISettingService _settingService;
private readonly ILocalizationService _localizationService;
private readonly SocialLinksSettings _socialMediaLinksSettings;
public SocialMediaController(ISettingService settingService,
ILocalizationService localizationService,
SocialLinksSettings socialMediaLinksSettings)
{
this._settingService = settingService;
this._localizationService = localizationService;
this._socialMediaLinksSettings = socialMediaLinksSettings;
}
[AdminAuthorize]
//[ChildActionOnly]
public ActionResult Configure()
{
var model = new ConfigurationModel();
model.FacebookLinkURL = _socialMediaLinksSettings.FacebookLinkURL;
model.TwitterLinkURL = _socialMediaLinksSettings.TwitterLinkURL;
model.RSSLinkURL = _socialMediaLinksSettings.RSSLinkURL;
return View("EbpCustom.Plugin.SocialMedia.Views.SocialMedia.Configure", model);
}
[HttpPost]
[AdminAuthorize]
//[ChildActionOnly]
public ActionResult Configure(ConfigurationModel model)
{
if (!ModelState.IsValid)
return Configure();
//save settings
_socialMediaLinksSettings.FacebookLinkURL = model.FacebookLinkURL;
_socialMediaLinksSettings.TwitterLinkURL = model.TwitterLinkURL;
_socialMediaLinksSettings.RSSLinkURL = model.RSSLinkURL;
_settingService.SaveSetting(_socialMediaLinksSettings);
return View("EbpCustom.Plugin.SocialMedia.Views.SocialMedia.Configure", model);
}
[ChildActionOnly]
public ActionResult SiteLinks()
{
var model = new SiteLinksModel();
model.FacebookLinkURL = _socialMediaLinksSettings.FacebookLinkURL;
model.TwitterLinkURL = _socialMediaLinksSettings.TwitterLinkURL;
model.RSSLinkURL = _socialMediaLinksSettings.RSSLinkURL;
return View("EbpCustom.Plugin.SocialMedia.Views.SocialMedia.SiteLinks", model);
}
}
}