コード例 #1
0
 public static Core.Models.Forms.DecimalField ToModel(this Entities.Forms.DecimalField entity)
 {
     return(new Core.Models.Forms.DecimalField
     {
         AllowFilter = entity.AllowFilter,
         IsUnique = entity.IsUnique,
         IsRequired = entity.IsRequired,
         FieldName = entity.FieldName,
         DisplayName = entity.DisplayName,
         AllowSort = entity.AllowSort,
         Description = entity.Description,
         DefaultValue = entity.DefaultValue,
         Max = entity.Max,
         Min = entity.Min
     });
 }
コード例 #2
0
ファイル: FormParser.cs プロジェクト: holdengong/EasyForm
        public DecimalField ToModel(Entities.Forms.DecimalField entity)
        {
            string fieldType = entity.FieldType;

            switch (fieldType)
            {
            case FieldTypes.Decimal:
                return(new DecimalField
                {
                    AllowFilter = entity.AllowFilter,
                    IsUnique = entity.IsUnique,
                    IsRequired = entity.IsRequired,
                    FieldName = entity.FieldName,
                    DisplayName = entity.DisplayName,
                    AllowSort = entity.AllowSort,
                    Description = entity.Description,
                    DefaultValue = entity.DefaultValue,
                    Max = entity.Max,
                    Min = entity.Min
                });
            }

            throw new InvalidOperationException($"unknown field type {fieldType}");
        }