Skip to content

Instantly share code, notes, and snippets.

@vmandic
Created May 14, 2019 07:48
Show Gist options
  • Save vmandic/394d6705c522d4eee7d649f61e758464 to your computer and use it in GitHub Desktop.
Save vmandic/394d6705c522d4eee7d649f61e758464 to your computer and use it in GitHub Desktop.
meds-processor, part/4, snippet #9
using System.Text;
using MedsProcessor.WebAPI.Infrastructure;
using Microsoft.AspNetCore.Mvc;
namespace MedsProcessor.WebAPI.Controllers
{
public class HomeController : ApiControllerBase
{
static bool isFirstTimeRun = true;
/// <summary>
/// Displays initial information about the Web API.
/// </summary>
/// <returns>Returns a JSON formatted message with basic Web API info.</returns>
[HttpGet("~/")]
public ActionResult<ApiMessageResponse> Index()
{
var statusUrl = Url.RouteUrl("Processor_GetStatus");
var sb = new StringBuilder();
sb.Append(isFirstTimeRun ?
"The HZZO meds-processor has started with the Web API launch!" :
"Welcome to the HZZO meds-processor.")
.Append($" You can check the status at: { statusUrl }");
isFirstTimeRun = false;
return ApiResponse.ForMessage(sb.ToString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment