Example #1
0
 public FieldOptionViewModel Create(CachedFieldOption cachedFieldOption)
 {
     return(new FieldOptionViewModel()
     {
         Value = cachedFieldOption.Value
     });
 }
Example #2
0
        private CachedFieldOption CacheFieldOption(Culture culture, FieldOption fieldOption)
        {
            CachedFieldOption cachedFieldOption = new CachedFieldOption();

            cachedFieldOption.FieldOptionId = fieldOption.Id;
            cachedFieldOption.Value         = this.GetLocalizationValue(culture.Id, fieldOption.ValueId);
            cachedFieldOption.Position      = fieldOption.Position;
            return(cachedFieldOption);
        }
        public FieldViewModel Build(CachedField cachedField)
        {
            IEnumerable <CachedFieldOption> cachedFieldOptions = new CachedFieldOption[] { };

            if (!string.IsNullOrEmpty(cachedField.CachedFieldOptions))
            {
                cachedFieldOptions = JsonConvert.DeserializeObject <IEnumerable <CachedFieldOption> >(cachedField.CachedFieldOptions);
            }

            return(new FieldViewModel()
            {
                Id = cachedField.FieldId,
                FieldType = new FieldTypeViewModel()
                {
                    Code = cachedField.FieldTypeCode
                },
                Name = cachedField.Name,
                FieldOptions = cachedFieldOptions.Select(
                    fo => new FieldOptionViewModelBuilder(this.handler).Build(fo)
                    )
            });
        }