예제 #1
0
        internal static FormFields MapFormFieldDbModel(FormFieldModel model)
        {
            FormFields formField = new FormFields()
            {
                ClassName   = model.ClassName,
                FormId      = model.FormId,
                Id          = model.Id,
                IsRequired  = model.IsRequired,
                Label       = model.Label,
                Type        = model.Type,
                CanMultiply = model.CanMultiply
            };

            if (model.Options.Count > 0)
            {
                formField.FormFieldsOptions = new List <FormFieldsOptions>();

                foreach (var option in model.Options)
                {
                    formField.FormFieldsOptions.Add(MapFormFieldOption(option));
                }
            }

            return(formField);
        }
예제 #2
0
파일: FormModel.cs 프로젝트: Tyre88/SlimWeb
        public static FormModel MapFormModel(Form form, bool deepLoad = false)
        {
            FormModel model = new FormModel()
            {
                ClubId          = form.ClubId,
                CreatedByUserId = form.CreatedByUserId,
                CreatedDate     = form.CreatedDate,
                EndDate         = form.EndDate,
                Id                = form.Id,
                IsDeleted         = form.IsDeleted,
                IsExternal        = form.IsExternal,
                Name              = form.Name,
                StartDate         = form.StartDate,
                Description       = form.Description,
                MultipleSubmits   = form.MultipleSubmits,
                SendThanksMail    = form.SendThanksMail,
                EmailFieldName    = form.EmailFieldName,
                EmailHtml         = form.EmailHtml,
                EnableExcelImport = form.EnableExcelImport,
                ExampleExcelPath  = form.ExampleExcelPath
            };

            if (deepLoad)
            {
                form.FormFields.ToList().ForEach(f => model.FormFields.Add(FormFieldModel.MapFormFieldModel(f)));
                form.Form_Emails.ToList().ForEach(e => model.Emails.Add(new FormEmailModel()
                {
                    Email  = e.Email,
                    Id     = e.Id,
                    FormId = e.FormId
                }));
            }

            return(model);
        }
예제 #3
0
        internal static FormFieldModel MapFormFieldModel(FormFields formField)
        {
            FormFieldModel model = new FormFieldModel()
            {
                ClassName   = formField.ClassName,
                FormId      = formField.FormId,
                Id          = formField.Id,
                IsRequired  = formField.IsRequired,
                Label       = formField.Label,
                Type        = formField.Type,
                CanMultiply = formField.CanMultiply
            };

            formField.FormFieldsOptions.ToList().ForEach(f => model.Options.Add(FormFieldOptionModel.MapFormFieldOptionModel(f)));

            return(model);
        }