public virtual ActionResult ChangeLanguage(long sectionId, String culture) { var section = sectionService.Find(sectionId); if (section == null || !permissionService.IsAllowed((Int32)SectionOperations.View, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object)) { throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this))); } bool allowManage = permissionService.IsAllowed((Int32)SectionOperations.Manage, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object); SectionViewModel model = new SectionViewModel { AllowManage = allowManage }.MapFrom(section); model.SelectedCulture = culture; //get locale var localeService = ServiceLocator.Current.GetInstance <ISectionLocaleService>(); SectionLocale locale = localeService.GetLocale(sectionId, culture); if (locale != null) { model.MapLocaleFrom(locale); } return(PartialView("SectionDetails", model)); }
public virtual ActionResult ChangeLanguage(long sectionId, String culture) { var section = sectionService.Find(sectionId); if (section == null || !permissionService.IsAllowed((Int32)SectionOperations.View, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object)) { throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this))); } bool allowManage = permissionService.IsAllowed((Int32)SectionOperations.Manage, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object); SectionViewModel model = new SectionViewModel { AllowManage = allowManage }.MapFrom(section); model.SelectedCulture = culture; //get locale var localeService = ServiceLocator.Current.GetInstance<ISectionLocaleService>(); SectionLocale locale = localeService.GetLocale(sectionId, culture); if (locale != null) model.MapLocaleFrom(locale); return PartialView("SectionDetails", model); }