public virtual ActionResult Update(long id, PluginViewModel pluginView) { var plugin = pluginService.Find(id); if (plugin == null) { throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.CouldNotFoundEntity")); } if (ModelState.IsValid) { var localeService = ServiceLocator.Current.GetInstance <IPluginLocaleService>(); PluginLocale pluginLocale = localeService.GetLocale(id, pluginView.SelectedCulture) ?? new PluginLocale { Plugin = plugin, Culture = pluginView.SelectedCulture }; pluginLocale.Title = pluginView.Title; pluginLocale.Description = pluginView.Description; localeService.Save(pluginLocale); Success(Translate("Messages.PluginUpdated")); return(RedirectToAction(MVC.Admin.Module.Index())); } Error(Translate("Messages.ValidationError")); return(View("Edit", pluginView)); }
public virtual ActionResult ChangeLanguage(long pluginId, String culture) { var plugin = pluginService.Find(pluginId); if (plugin == null) { throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.PluginNotFound")); } PluginViewModel model = new PluginViewModel().MapFrom(plugin); model.SelectedCulture = culture; var localeService = ServiceLocator.Current.GetInstance <IPluginLocaleService>(); PluginLocale locale = localeService.GetLocale(pluginId, culture); if (locale != null) { model.Title = locale.Title; model.Description = locale.Description; } return(PartialView("EditForm", model)); }