Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 internal void Add(BsEditorToolbarPart part)
 {
     this.parts.Add(part);
 }
Ejemplo n.º 3
0
        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);
        }