public DashboardItem(dynamic obj) { if (obj.id != null) { Id = obj.id; } HeaderText = obj.header_text; Type = obj.type; SortOrder = obj.sort_order; switch (Type) { case "simple": Body = new SimpleDashboardBody(obj.body); break; case "list": Body = new ListDashboardBody(obj.body); break; case "horizontal_bar": Body = new HorizontalBarChartDashboardBody(obj.body); break; default: Body = null; break; } }
public DashboardItem(Entity entity) { Id = entity.Key.Path.First().Id; HeaderText = (string)entity["header_text"]; Type = (string)entity["type"]; SortOrder = (int)entity["sort_order"]; switch (Type) { case "simple": Body = new SimpleDashboardBody((Entity)entity["body"]); break; case "list": Body = new ListDashboardBody((Entity)entity["body"]); break; case "horizontal_bar": Body = new HorizontalBarChartDashboardBody((Entity)entity["body"]); break; default: Body = null; break; } }