Add /shared-button url
This commit is contained in:
parent
813b48bbdb
commit
5cc7f15909
|
@ -50,12 +50,12 @@ namespace AspNetCoreMvc.Controllers
|
|||
|
||||
public static List<Samples.ISample> Samples => lazySamples.Value;
|
||||
|
||||
[Route("/Samples/Run/{name}")]
|
||||
[Route ("/Samples/Run/{name}")]
|
||||
public IActionResult Run (string name, bool shared)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace (name) || name.Length > 32)
|
||||
return BadRequest ();
|
||||
|
||||
|
||||
var s = Samples.FirstOrDefault (x => x.Title == name);
|
||||
if (s == null)
|
||||
return NotFound ();
|
||||
|
@ -73,5 +73,11 @@ namespace AspNetCoreMvc.Controllers
|
|||
sharedSamples[s.Title] = e;
|
||||
return e;
|
||||
}
|
||||
|
||||
[Route ("/shared-button")]
|
||||
public IActionResult SharedButton ()
|
||||
{
|
||||
return Run ("Button Counter", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ namespace Samples
|
|||
|
||||
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;
|
||||
button.Clicked += (s, e) => {
|
||||
count++;
|
||||
|
|
|
@ -9,15 +9,6 @@ namespace Samples
|
|||
{
|
||||
public string Title => "Todo List";
|
||||
|
||||
List items = new List () {
|
||||
ClassName = "list-group",
|
||||
};
|
||||
|
||||
public TodoSample ()
|
||||
{
|
||||
items.Style.MarginTop = "1em";
|
||||
}
|
||||
|
||||
class Item : ListItem
|
||||
{
|
||||
Element label = new Div ();
|
||||
|
@ -48,6 +39,11 @@ namespace Samples
|
|||
|
||||
Element MakeTodo ()
|
||||
{
|
||||
List items = new List () {
|
||||
ClassName = "list-group",
|
||||
};
|
||||
items.Style.MarginTop = "1em";
|
||||
|
||||
var heading = new Heading ("Todo List");
|
||||
var subtitle = new Paragraph ("This is the shared todo list of the world.");
|
||||
var inputForm = new Form {
|
||||
|
|
Loading…
Reference in New Issue