示例#1
0
        public virtual ActionResult ChangeFormElementLanguage(long formElementId, String culture)
        {
            var formElement = formsElementService.Find(formElementId);

            if (formElement == null || formElement.Form == null || !permissionService.IsAllowed((Int32)FormOperations.Manage, this.CorePrincipal(), typeof(Form), formElement.Form.Id, IsFormOwner(formElement.Form), PermissionOperationLevel.Object))
            {
                throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
            }

            FormElementViewModel model = new FormElementViewModel {
                FormId = formElement.Form.Id
            }.MapFrom(formElement);

            model.SelectedCulture = culture;

            //get locale
            var localeService        = ServiceLocator.Current.GetInstance <IFormElementLocaleService>();
            FormElementLocale locale = localeService.GetLocale(formElementId, culture);

            if (locale != null)
            {
                model.MapLocaleFrom(locale);
            }

            return(PartialView("FormElementEditor", model));
        }
        public virtual ActionResult ChangeFormElementLanguage(long formElementId, String culture)
        {
            var formElement = formsElementService.Find(formElementId);

            if (formElement == null || formElement.Form == null || !permissionService.IsAllowed((Int32)FormOperations.Manage, this.CorePrincipal(), typeof(Form), formElement.Form.Id, IsFormOwner(formElement.Form), PermissionOperationLevel.Object))
            {
                throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
            }

            FormElementViewModel model = new FormElementViewModel{FormId = formElement.Form.Id}.MapFrom(formElement);
            model.SelectedCulture = culture;

            //get locale
            var localeService = ServiceLocator.Current.GetInstance<IFormElementLocaleService>();
            FormElementLocale locale = localeService.GetLocale(formElementId, culture);

            if (locale != null)
                model.MapLocaleFrom(locale);

            return PartialView("FormElementEditor", model);
        }