You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/IoTDameon/Controllers/HomeController.cs

38 lines
983 B

using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Reflection;
namespace IoTDameon.Controllers
{
public class HomeController : Controller
{
private readonly IWebHostEnvironment _env;
public HomeController(IWebHostEnvironment env)
{
this._env = env;
}
public IActionResult Index(string command)
{
if (!string.IsNullOrEmpty(command))
{
try
{
ViewBag.Output = command.Bash();
}
catch (Exception ex)
{
ViewBag.Output = ex.ToString();
}
}
return View(model: command);
}
public IActionResult GetVersion()
{
return Content(Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);
}
}
}