123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Web.Http;
- using System.Web.Mvc;
- using WebAPiUtils_test.Areas.HelpPage.Models;
-
- namespace WebAPiUtils_test.Areas.HelpPage.Controllers
- {
- /// <summary>
- /// The controller that will handle requests for the help page.
- /// </summary>
- public class HelpController : Controller
- {
- 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("Error");
- }
- }
- }
|