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().InformationalVersion); } } }