diff --git a/PlatformSamples/AspNetCoreMvc/Controllers/HomeController.cs b/PlatformSamples/AspNetCoreMvc/Controllers/HomeController.cs index c731285..11687ab 100644 --- a/PlatformSamples/AspNetCoreMvc/Controllers/HomeController.cs +++ b/PlatformSamples/AspNetCoreMvc/Controllers/HomeController.cs @@ -13,10 +13,15 @@ namespace AspNetCoreMvc.Controllers { public class HomeController : Controller { - public IActionResult Index() + public IActionResult Index () + { + return View (); + } + + public IActionResult Clicker () { var count = 0; - var head = new Heading { Text = "Ooui!" }; + var head = new Heading { Text = "Click away!" }; var label = new Label { Text = "0" }; var btn = new Button { Text = "Increase" }; btn.Clicked += (sender, e) => { @@ -30,23 +35,23 @@ namespace AspNetCoreMvc.Controllers return new ElementResult (div); } - public IActionResult About() + public IActionResult About () { ViewData["Message"] = "Your application description page."; - return View(); + return View (); } - public IActionResult Contact() + public IActionResult Contact () { ViewData["Message"] = "Your contact page."; - return View(); + return View (); } - public IActionResult Error() + public IActionResult Error () { - return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + return View (new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } } diff --git a/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs b/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs new file mode 100644 index 0000000..0bab99a --- /dev/null +++ b/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +using AspNetCoreMvc.Models; +using Ooui; +using Ooui.AspNetCore; + +namespace AspNetCoreMvc.Controllers +{ + public class SamplesController : Controller + { + public IActionResult Clicker () + { + var count = 0; + var head = new Heading { Text = "Click away!" }; + var label = new Label { Text = "0" }; + var btn = new Button { Text = "Increase" }; + btn.Clicked += (sender, e) => { + count++; + label.Text = count.ToString (); + }; + var div = new Div (); + div.AppendChild (head); + div.AppendChild (label); + div.AppendChild (btn); + return new ElementResult (div); + } + } +} diff --git a/PlatformSamples/AspNetCoreMvc/Views/Home/Index.cshtml b/PlatformSamples/AspNetCoreMvc/Views/Home/Index.cshtml index ddaa40c..3461f7c 100644 --- a/PlatformSamples/AspNetCoreMvc/Views/Home/Index.cshtml +++ b/PlatformSamples/AspNetCoreMvc/Views/Home/Index.cshtml @@ -1,108 +1,29 @@ @{ - ViewData["Title"] = "Home Page"; + ViewData["Title"] = "Ooui"; } -