|
|
|
@ -4,6 +4,8 @@ using System.Diagnostics; |
|
|
|
|
|
|
|
|
|
namespace AspNetCoreMVC.Controllers |
|
|
|
|
{ |
|
|
|
|
//[Route("Home")] |
|
|
|
|
[Route("[controller]")] // 컨트롤러 이름 자동으로 따라감
|
|
|
|
|
public class HomeController : Controller |
|
|
|
|
{ |
|
|
|
|
private readonly ILogger<HomeController> _logger; |
|
|
|
@ -38,6 +40,40 @@ namespace AspNetCoreMVC.Controllers |
|
|
|
|
return View(viewModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpPost("Post")] |
|
|
|
|
public IActionResult PostOnly() |
|
|
|
|
{ |
|
|
|
|
return Ok(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Route("Test")] // 컨트롤러 하위 상대경로 |
|
|
|
|
[Route("/TestSecret")] // 절대경로 |
|
|
|
|
public IEnumerable<string> ApiTest() |
|
|
|
|
{ |
|
|
|
|
List<string> names = new List<string>() |
|
|
|
|
{ |
|
|
|
|
"Four", "Five", "Six", "Seven" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return names; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IActionResult Sample() |
|
|
|
|
{ |
|
|
|
|
SampleViewModel viewModel = new SampleViewModel() |
|
|
|
|
{ |
|
|
|
|
Id = 1005, |
|
|
|
|
Count = 2 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return View(viewModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IActionResult BuyItem(int id, int count) |
|
|
|
|
{ |
|
|
|
|
return View(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IActionResult Test1(int id, [FromHeader] string value) |
|
|
|
|
{ |
|
|
|
|
return null; |
|
|
|
|