28 lines
616 B
C#
28 lines
616 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Web.Controllers
|
|
{
|
|
[Route("Home")]
|
|
public class HomeController : Controller
|
|
{
|
|
[Route("Hello")]
|
|
public JsonResult Hello(Hello request)
|
|
{
|
|
return new JsonResult(new HelloResponse() {Result = $"hello, {request?.Name ?? "System.NullReferenceException"}"});
|
|
}
|
|
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
}
|
|
|
|
public class Hello
|
|
{
|
|
public string Name { get; set; }
|
|
}
|
|
public class HelloResponse
|
|
{
|
|
public string Result { get; set; }
|
|
}
|
|
} |