mirror of
https://github.com/rudollee/LearningMVC.git
synced 2025-06-07 16:06:21 +00:00
32 lines
796 B
C#
32 lines
796 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.IO;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace Views.Infrastructure
|
|
{
|
|
public class DebugDataView : IView
|
|
{
|
|
public void Render(ViewContext viewContext, TextWriter writer)
|
|
{
|
|
Write(writer, "---Routing Data---");
|
|
foreach (string key in viewContext.RouteData.Values.Keys)
|
|
{
|
|
Write(writer, "Key: {0}, Value: {1}", key, viewContext.RouteData.Values[key]);
|
|
}
|
|
|
|
Write(writer, "---View Data---");
|
|
foreach (string key in viewContext.ViewData.Keys)
|
|
{
|
|
Write(writer, "Key: {0}, Value: {1}", key, viewContext.ViewData[key]);
|
|
}
|
|
}
|
|
|
|
private void Write(TextWriter writer, string template, params object[] values)
|
|
{
|
|
writer.Write(string.Format(template, values) + "<p/>");
|
|
}
|
|
}
|
|
} |