diff options
Diffstat (limited to 'ApartmentManager/HousingWebApi/Areas/HelpPage/Views')
20 files changed, 415 insertions, 0 deletions
diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Api.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Api.cshtml new file mode 100644 index 0000000..54de52c --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Api.cshtml @@ -0,0 +1,22 @@ +@using System.Web.Http +@using HousingWebApi.Areas.HelpPage.Models +@model HelpPageApiModel + +@{ + var description = Model.ApiDescription; + ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath; +} + +<link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" /> +<div id="body" class="help-page"> + <section class="featured"> + <div class="content-wrapper"> + <p> + @Html.ActionLink("Help Page Home", "Index") + </p> + </div> + </section> + <section class="content-wrapper main-content clear-fix"> + @Html.DisplayForModel() + </section> +</div> diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml new file mode 100644 index 0000000..8be198c --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml @@ -0,0 +1,41 @@ +@using System.Web.Http +@using System.Web.Http.Controllers +@using System.Web.Http.Description +@using HousingWebApi.Areas.HelpPage +@using HousingWebApi.Areas.HelpPage.Models +@model IGrouping<HttpControllerDescriptor, ApiDescription> + +@{ + var controllerDocumentation = ViewBag.DocumentationProvider != null ? + ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : + null; +} + +<h2 id="@Model.Key.ControllerName">@Model.Key.ControllerName</h2> +@if (!String.IsNullOrEmpty(controllerDocumentation)) +{ + <p>@controllerDocumentation</p> +} +<table class="help-page-table"> + <thead> + <tr><th>API</th><th>Description</th></tr> + </thead> + <tbody> + @foreach (var api in Model) + { + <tr> + <td class="api-name"><a href="@Url.Action("Api", "Help", new { apiId = api.GetFriendlyId() })">@api.HttpMethod.Method @api.RelativePath</a></td> + <td class="api-documentation"> + @if (api.Documentation != null) + { + <p>@api.Documentation</p> + } + else + { + <p>No documentation available.</p> + } + </td> + </tr> + } + </tbody> +</table>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/CollectionModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/CollectionModelDescription.cshtml new file mode 100644 index 0000000..9f4b62c --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/CollectionModelDescription.cshtml @@ -0,0 +1,6 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model CollectionModelDescription +@if (Model.ElementDescription is ComplexTypeModelDescription) +{ + @Html.DisplayFor(m => m.ElementDescription) +}
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ComplexTypeModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ComplexTypeModelDescription.cshtml new file mode 100644 index 0000000..5963685 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ComplexTypeModelDescription.cshtml @@ -0,0 +1,3 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model ComplexTypeModelDescription +@Html.DisplayFor(m => m.Properties, "Parameters")
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/DictionaryModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/DictionaryModelDescription.cshtml new file mode 100644 index 0000000..9fe64f8 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/DictionaryModelDescription.cshtml @@ -0,0 +1,4 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model DictionaryModelDescription +Dictionary of @Html.DisplayFor(m => Model.KeyModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.KeyModelDescription }) [key] +and @Html.DisplayFor(m => Model.ValueModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ValueModelDescription }) [value]
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/EnumTypeModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/EnumTypeModelDescription.cshtml new file mode 100644 index 0000000..69cb12d --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/EnumTypeModelDescription.cshtml @@ -0,0 +1,24 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model EnumTypeModelDescription + +<p>Possible enumeration values:</p> + +<table class="help-page-table"> + <thead> + <tr><th>Name</th><th>Value</th><th>Description</th></tr> + </thead> + <tbody> + @foreach (EnumValueDescription value in Model.Values) + { + <tr> + <td class="enum-name"><b>@value.Name</b></td> + <td class="enum-value"> + <p>@value.Value</p> + </td> + <td class="enum-description"> + <p>@value.Documentation</p> + </td> + </tr> + } + </tbody> +</table>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml new file mode 100644 index 0000000..e107cae --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml @@ -0,0 +1,67 @@ +@using System.Web.Http +@using System.Web.Http.Description +@using HousingWebApi.Areas.HelpPage.Models +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model HelpPageApiModel + +@{ + ApiDescription description = Model.ApiDescription; +} +<h1>@description.HttpMethod.Method @description.RelativePath</h1> +<div> + <p>@description.Documentation</p> + + <h2>Request Information</h2> + + <h3>URI Parameters</h3> + @Html.DisplayFor(m => m.UriParameters, "Parameters") + + <h3>Body Parameters</h3> + + <p>@Model.RequestDocumentation</p> + + @if (Model.RequestModelDescription != null) + { + @Html.DisplayFor(m => m.RequestModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.RequestModelDescription }) + if (Model.RequestBodyParameters != null) + { + @Html.DisplayFor(m => m.RequestBodyParameters, "Parameters") + } + } + else + { + <p>None.</p> + } + + @if (Model.SampleRequests.Count > 0) + { + <h3>Request Formats</h3> + @Html.DisplayFor(m => m.SampleRequests, "Samples") + } + + <h2>Response Information</h2> + + <h3>Resource Description</h3> + + <p>@description.ResponseDescription.Documentation</p> + + @if (Model.ResourceDescription != null) + { + @Html.DisplayFor(m => m.ResourceDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ResourceDescription }) + if (Model.ResourceProperties != null) + { + @Html.DisplayFor(m => m.ResourceProperties, "Parameters") + } + } + else + { + <p>None.</p> + } + + @if (Model.SampleResponses.Count > 0) + { + <h3>Response Formats</h3> + @Html.DisplayFor(m => m.SampleResponses, "Samples") + } + +</div>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml new file mode 100644 index 0000000..4b0144a --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml @@ -0,0 +1,4 @@ +@using HousingWebApi.Areas.HelpPage +@model ImageSample + +<img src="@Model.Src" />
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml new file mode 100644 index 0000000..9967e5f --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml @@ -0,0 +1,13 @@ +@using HousingWebApi.Areas.HelpPage +@model InvalidSample + +@if (HttpContext.Current.IsDebuggingEnabled) +{ + <div class="warning-message-container"> + <p>@Model.ErrorMessage</p> + </div> +} +else +{ + <p>Sample not available.</p> +}
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/KeyValuePairModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/KeyValuePairModelDescription.cshtml new file mode 100644 index 0000000..91e9cff --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/KeyValuePairModelDescription.cshtml @@ -0,0 +1,4 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model KeyValuePairModelDescription +Pair of @Html.DisplayFor(m => Model.KeyModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.KeyModelDescription }) [key] +and @Html.DisplayFor(m => Model.ValueModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ValueModelDescription }) [value]
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ModelDescriptionLink.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ModelDescriptionLink.cshtml new file mode 100644 index 0000000..13c8ccc --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/ModelDescriptionLink.cshtml @@ -0,0 +1,26 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model Type +@{ + ModelDescription modelDescription = ViewBag.modelDescription; + if (modelDescription is ComplexTypeModelDescription || modelDescription is EnumTypeModelDescription) + { + if (Model == typeof(Object)) + { + @:Object + } + else + { + @Html.ActionLink(modelDescription.Name, "ResourceModel", "Help", new { modelName = modelDescription.Name }, null) + } + } + else if (modelDescription is CollectionModelDescription) + { + var collectionDescription = modelDescription as CollectionModelDescription; + var elementDescription = collectionDescription.ElementDescription; + @:Collection of @Html.DisplayFor(m => elementDescription.ModelType, "ModelDescriptionLink", new { modelDescription = elementDescription }) + } + else + { + @Html.DisplayFor(m => modelDescription) + } +}
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml new file mode 100644 index 0000000..045a4e4 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml @@ -0,0 +1,48 @@ +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using System.Web.Http.Description +@using System.Threading +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model IList<ParameterDescription> + +@if (Model.Count > 0) +{ + <table class="help-page-table"> + <thead> + <tr><th>Name</th><th>Description</th><th>Type</th><th>Additional information</th></tr> + </thead> + <tbody> + @foreach (ParameterDescription parameter in Model) + { + ModelDescription modelDescription = parameter.TypeDescription; + <tr> + <td class="parameter-name">@parameter.Name</td> + <td class="parameter-documentation"> + <p>@parameter.Documentation</p> + </td> + <td class="parameter-type"> + @Html.DisplayFor(m => modelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = modelDescription }) + </td> + <td class="parameter-annotations"> + @if (parameter.Annotations.Count > 0) + { + foreach (var annotation in parameter.Annotations) + { + <p>@annotation.Documentation</p> + } + } + else + { + <p>None.</p> + } + </td> + </tr> + } + </tbody> + </table> +} +else +{ + <p>None.</p> +} + diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml new file mode 100644 index 0000000..c19596f --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml @@ -0,0 +1,30 @@ +@using System.Net.Http.Headers +@model Dictionary<MediaTypeHeaderValue, object> + +@{ + // Group the samples into a single tab if they are the same. + Dictionary<string, object> samples = Model.GroupBy(pair => pair.Value).ToDictionary( + pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), + pair => pair.Key); + var mediaTypes = samples.Keys; +} +<div> + @foreach (var mediaType in mediaTypes) + { + <h4 class="sample-header">@mediaType</h4> + <div class="sample-content"> + <span><b>Sample:</b></span> + @{ + var sample = samples[mediaType]; + if (sample == null) + { + <p>Sample not available.</p> + } + else + { + @Html.DisplayFor(s => sample); + } + } + </div> + } +</div>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/SimpleTypeModelDescription.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/SimpleTypeModelDescription.cshtml new file mode 100644 index 0000000..4433658 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/SimpleTypeModelDescription.cshtml @@ -0,0 +1,3 @@ +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model SimpleTypeModelDescription +@Model.Documentation
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml new file mode 100644 index 0000000..f47154f --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml @@ -0,0 +1,6 @@ +@using HousingWebApi.Areas.HelpPage +@model TextSample + +<pre class="wrapped"> +@Model.Text +</pre>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Index.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Index.cshtml new file mode 100644 index 0000000..51eb9c0 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/Index.cshtml @@ -0,0 +1,38 @@ +@using System.Web.Http +@using System.Web.Http.Controllers +@using System.Web.Http.Description +@using System.Collections.ObjectModel +@using HousingWebApi.Areas.HelpPage.Models +@model Collection<ApiDescription> + +@{ + ViewBag.Title = "ASP.NET Web API Help Page"; + + // Group APIs by controller + ILookup<HttpControllerDescriptor, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); +} + +<link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" /> +<header class="help-page"> + <div class="content-wrapper"> + <div class="float-left"> + <h1>@ViewBag.Title</h1> + </div> + </div> +</header> +<div id="body" class="help-page"> + <section class="featured"> + <div class="content-wrapper"> + <h2>Introduction</h2> + <p> + Provide a general description of your APIs here. + </p> + </div> + </section> + <section class="content-wrapper main-content clear-fix"> + @foreach (var group in apiGroups) + { + @Html.DisplayFor(m => group, "ApiGroup") + } + </section> +</div> diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/ResourceModel.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/ResourceModel.cshtml new file mode 100644 index 0000000..db20b87 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Help/ResourceModel.cshtml @@ -0,0 +1,19 @@ +@using System.Web.Http +@using HousingWebApi.Areas.HelpPage.ModelDescriptions +@model ModelDescription + +<link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" /> +<div id="body" class="help-page"> + <section class="featured"> + <div class="content-wrapper"> + <p> + @Html.ActionLink("Help Page Home", "Index") + </p> + </div> + </section> + <h1>@Model.Name</h1> + <p>@Model.Documentation</p> + <section class="content-wrapper main-content clear-fix"> + @Html.DisplayFor(m => Model) + </section> +</div> diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Shared/_Layout.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..896c833 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Shared/_Layout.cshtml @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width" /> + <title>@ViewBag.Title</title> + @RenderSection("scripts", required: false) +</head> +<body> + @RenderBody() +</body> +</html>
\ No newline at end of file diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Web.config b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Web.config new file mode 100644 index 0000000..0971732 --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/Web.config @@ -0,0 +1,41 @@ +<?xml version="1.0"?> + +<configuration> + <configSections> + <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + </sectionGroup> + </configSections> + + <system.web.webPages.razor> + <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> + <pages pageBaseType="System.Web.Mvc.WebViewPage"> + <namespaces> + <add namespace="System.Web.Mvc" /> + <add namespace="System.Web.Mvc.Ajax" /> + <add namespace="System.Web.Mvc.Html" /> + <add namespace="System.Web.Routing" /> + </namespaces> + </pages> + </system.web.webPages.razor> + + <appSettings> + <add key="webpages:Enabled" value="false" /> + </appSettings> + + <system.web> + <compilation debug="true"> + <assemblies> + <add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + </assemblies> + </compilation> + </system.web> + + <system.webServer> + <handlers> + <remove name="BlockViewHandler"/> + <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> + </handlers> + </system.webServer> +</configuration> diff --git a/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/_ViewStart.cshtml b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/_ViewStart.cshtml new file mode 100644 index 0000000..d735b1c --- /dev/null +++ b/ApartmentManager/HousingWebApi/Areas/HelpPage/Views/_ViewStart.cshtml @@ -0,0 +1,4 @@ +@{ + // Change the Layout path below to blend the look and feel of the help page with your existing web pages + Layout = "~/Views/Shared/_Layout.cshtml"; +}
\ No newline at end of file |