Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Microsoft.AspNetCore.Mvc;
public class User
{
public string Name { get; set; }
public int Age { get; set; }
}
public class HomeController : Controller
{
// Form Binding
[HttpPost]
public IActionResult Create(User user)
{
return Content($"Form Binding: {user.Name}, {user.Age}");
}
// Query String Binding: /home/search?name=Alice
public IActionResult Search(string name)
{
return Content("Query Binding: " + name);
}
// Route Binding: /home/details/5
[HttpGet("details/{id}")]
public IActionResult Details(int id)
{
return Content("Route Binding ID: " + id);
}
}Coding works best on desktop or with an external keyboard.