public Func <HtmlHelper, IHtmlString> Visualize(AuditEventView ev, AuditEventKind kind,
                                                 IDictionary <IAuditProperty, Func <HtmlHelper, IHtmlString> > visualizedProperties)
 {
     return(html => html.Partial <Views.Notifications.Event>()
            .WithModel(new Audit.UI.VisualizedAuditEvent
     {
         Event = ev,
         Kind = kind,
         VisualizedProperties = visualizedProperties
     }));
 }
 public Func <HtmlHelper, IHtmlString> Visualize(AuditEventView ev, AuditEventKind kind,
                                                 IDictionary <IAuditProperty, Func <HtmlHelper, IHtmlString> > visualizedProperties)
 {
     return(html => new MvcHtmlString(kind.Name + ": " + string.Join(", ", visualizedProperties.Select(
                                                                         p =>
     {
         var v = p.Value == null ? null : p.Value(html);
         var vs = v == null ? "<null>" : v.ToHtmlString();
         return p.Key.Name + " = " + vs;
     }
                                                                         ))));
 }
Exemple #3
0
 public Func <HtmlHelper, IHtmlString> Visualize(AuditEventView ev, AuditEventKind kind,
                                                 IDictionary <IAuditProperty, Func <HtmlHelper, IHtmlString> > visualizedProperties)
 {
     return(html => new MvcHtmlString(string.Format(_format,
                                                    _formatArgs.Select(
                                                        a => from na in Maybe.Value(a)
                                                        from v in visualizedProperties.MaybeGet(na)
                                                        from str in v(html)
                                                        select str.ToHtmlString()
                                                        )
                                                    .Select(a => a.ValueOrNull())
                                                    .Cast <object>()
                                                    .ToArray()
                                                    )));
 }