public void Edit() { Process(delegate(HtmlBuilder b) { string cn = _dctx.Info.HandleType.Name; object o = this["Item"]; object id = _dctx.Handler.GetKeyValue(o); b.h1.text(cn + " Edit").end.enter(); b.form("post", UrlTo(ControllerName).Action("update").Parameters(id)).enter(); foreach (MemberHandler m in _dctx.Info.Members) { if (!m.Is.RelationField && !m.Is.DbGenerate && !m.Is.AutoSavedValue) { string n = cn + "_" + m.Name; string n1 = cn + "[" + m.Name + "]"; object v = m.GetValue(o); if (m.Is.LazyLoad) { v = m.MemberType.GetProperty("Value").GetValue(v, null); } b.p.label.attr("for", n).text(m.Name).end.br.include(ControlMapper.Map(m, n, n1, v)).end.enter(); } } b.input.name("commit").type("submit").value("Update").end.enter().end.enter().enter(); b.include(LinkTo(ControllerName).Title("Show").Action("show").Parameters(id)).enter(); b.include(LinkTo(ControllerName).Title("Back").Action("list")).enter(); }); }
public void New() { Process(delegate(HtmlBuilder b) { string cn = _dctx.Info.HandleType.Name; b.h1.text("New " + cn).end.enter(); b.form("post", UrlTo(ControllerName).Action("create")).enter(); foreach (MemberHandler m in _dctx.Info.Members) { if (!m.Is.RelationField && !m.Is.DbGenerate && !m.Is.AutoSavedValue) { string n = cn + "_" + m.Name; string n1 = cn + "[" + m.Name + "]"; b.p.label.attr("for", n).text(m.Name).end.br.include(ControlMapper.Map(m, n, n1, null)).end.enter(); } } b.input.name("commit").type("submit").value("Create").end.enter().end.enter().enter(); b.include(LinkTo(ControllerName).Title("Back").Action("list")).enter(); }); }
public static HtmlBuilder Map(MemberHandler m, string id, string name, object value) { var c = new ControlMapper(m, id, name, value); return(c._html); }
public static HtmlBuilder Map(MemberHandler m, string id, string name, object value) { var c = new ControlMapper(m, id, name, value); return c._html; }