初始化
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
@using $rootnamespace$.Areas.HelpPage.ModelDescriptions
|
||||
@model CollectionModelDescription
|
||||
@if (Model.ElementDescription is ComplexTypeModelDescription)
|
||||
{
|
||||
@Html.DisplayFor(m => m.ElementDescription)
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using $rootnamespace$.Areas.HelpPage.ModelDescriptions;
|
||||
using $rootnamespace$.Areas.HelpPage.Models;
|
||||
|
||||
namespace $rootnamespace$.Areas.HelpPage.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// The controller that will handle requests for the help page.
|
||||
/// </summary>
|
||||
public class HelpController : Controller
|
||||
{
|
||||
private const string ErrorViewName = "Error";
|
||||
|
||||
public HelpController()
|
||||
: this(GlobalConfiguration.Configuration)
|
||||
{
|
||||
}
|
||||
|
||||
public HelpController(HttpConfiguration config)
|
||||
{
|
||||
Configuration = config;
|
||||
}
|
||||
|
||||
public HttpConfiguration Configuration { get; private set; }
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
|
||||
return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
|
||||
}
|
||||
|
||||
public ActionResult Api(string apiId)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(apiId))
|
||||
{
|
||||
HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId);
|
||||
if (apiModel != null)
|
||||
{
|
||||
return View(apiModel);
|
||||
}
|
||||
}
|
||||
|
||||
return View(ErrorViewName);
|
||||
}
|
||||
|
||||
public ActionResult ResourceModel(string modelName)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(modelName))
|
||||
{
|
||||
ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator();
|
||||
ModelDescription modelDescription;
|
||||
if (modelDescriptionGenerator.GeneratedModels.TryGetValue(modelName, out modelDescription))
|
||||
{
|
||||
return View(modelDescription);
|
||||
}
|
||||
}
|
||||
|
||||
return View(ErrorViewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user