public BsEditorToolbarPart Add <TValue>(Expression <Func <TModel, TValue> > expression, string template) where TValue : class { var part = new BsEditorToolbarPart(); part.Template(template); this.FillDetails <TValue>((TModel)this.model, expression, part); Add(part); return(part); }
internal void Add(BsEditorToolbarPart part) { this.parts.Add(part); }
internal BsEditorToolbarPart FillDetails <TValue>(TModel model, Expression <Func <TModel, TValue> > expression, BsEditorToolbarPart part) where TValue : class { var name = model.GetPropertyName(expression); var type = typeof(TModel); var property = type.GetProperty(name); var value = model != null ? (TValue)property.GetValue(model) : null; var uid = this.uid + "." + name; part.uid = uid; part.form = new BsEditorFormBuilder <TValue>((TValue)value, uid, this.viewContext).Hide(); return(part); }