private static string MakeHtmlFormEditorFor(ContractDescriptor model) { var descriptors = PropertyDescriptor.GetProperties(model.Type); var maxPropertyLength = descriptors.Max(x => x.Name.Length); var form = BuildFormTag(model.Name); foreach (var property in descriptors) { form.InnerHtml += MakeHtmlForProperty(property, maxPropertyLength); } form.InnerHtml += MakeHtmlForSubmitButton(); foreach (var msg in model.ErrorMessages) { form.InnerHtml += MakeHtmlForError(msg); } return form.ToString(); }
public static string For(ContractDescriptor model) { return MakeHtmlFormEditorFor(model); }