Add /shared-button url

This commit is contained in:
Frank A. Krueger 2017-11-15 23:48:12 -06:00
parent 813b48bbdb
commit 5cc7f15909
3 changed files with 17 additions and 12 deletions

View File

@ -50,12 +50,12 @@ namespace AspNetCoreMvc.Controllers
public static List<Samples.ISample> Samples => lazySamples.Value; public static List<Samples.ISample> Samples => lazySamples.Value;
[Route("/Samples/Run/{name}")] [Route ("/Samples/Run/{name}")]
public IActionResult Run (string name, bool shared) public IActionResult Run (string name, bool shared)
{ {
if (string.IsNullOrWhiteSpace (name) || name.Length > 32) if (string.IsNullOrWhiteSpace (name) || name.Length > 32)
return BadRequest (); return BadRequest ();
var s = Samples.FirstOrDefault (x => x.Title == name); var s = Samples.FirstOrDefault (x => x.Title == name);
if (s == null) if (s == null)
return NotFound (); return NotFound ();
@ -73,5 +73,11 @@ namespace AspNetCoreMvc.Controllers
sharedSamples[s.Title] = e; sharedSamples[s.Title] = e;
return e; return e;
} }
[Route ("/shared-button")]
public IActionResult SharedButton ()
{
return Run ("Button Counter", true);
}
} }
} }

View File

@ -9,7 +9,10 @@ namespace Samples
Button MakeButton () Button MakeButton ()
{ {
var button = new Button ("Click me!"); var button = new Button ("Click me!") {
ClassName = "btn btn-primary", // Some bootstrap styling
};
button.Style.MarginTop = "2em";
var count = 0; var count = 0;
button.Clicked += (s, e) => { button.Clicked += (s, e) => {
count++; count++;

View File

@ -9,15 +9,6 @@ namespace Samples
{ {
public string Title => "Todo List"; public string Title => "Todo List";
List items = new List () {
ClassName = "list-group",
};
public TodoSample ()
{
items.Style.MarginTop = "1em";
}
class Item : ListItem class Item : ListItem
{ {
Element label = new Div (); Element label = new Div ();
@ -48,6 +39,11 @@ namespace Samples
Element MakeTodo () Element MakeTodo ()
{ {
List items = new List () {
ClassName = "list-group",
};
items.Style.MarginTop = "1em";
var heading = new Heading ("Todo List"); var heading = new Heading ("Todo List");
var subtitle = new Paragraph ("This is the shared todo list of the world."); var subtitle = new Paragraph ("This is the shared todo list of the world.");
var inputForm = new Form { var inputForm = new Form {