public FormViewModel Create(SerializedForm serializedForm) { IEnumerable <SerializedField> serializedFields = new SerializedField[] { }; if (!string.IsNullOrEmpty(serializedForm.SerializedFields)) { serializedFields = JsonConvert.DeserializeObject <IEnumerable <SerializedField> >(serializedForm.SerializedFields); } return(new FormViewModel() { Id = serializedForm.FormId, Name = serializedForm.Name, Fields = serializedFields.Select( sf => new FieldViewModelFactory(this.RequestHandler).Create(sf) ).ToList() }); }
public FormViewModel Create(SerializedForm serializedForm, string partialViewName, string additionalCssClass) { IEnumerable <SerializedField> serializedFields = new SerializedField[] { }; if (!string.IsNullOrEmpty(serializedForm.SerializedFields)) { serializedFields = JsonConvert.DeserializeObject <IEnumerable <SerializedField> >(serializedForm.SerializedFields); } return(new FormViewModel() { Id = serializedForm.FormId, Name = serializedForm.Name, SubmitButtonTitle = serializedForm.SubmitButtonTitle, Fields = serializedFields.Select( sf => new FieldViewModelFactory(this.RequestHandler).Create(sf) ).ToList(), PartialViewName = partialViewName ?? "_Form", AdditionalCssClass = additionalCssClass }); }