diff --git a/WebApplicationLesson1/Controllers/CalculatorController.cs b/WebApplicationLesson1/Controllers/CalculatorController.cs new file mode 100644 index 0000000..21e0e56 --- /dev/null +++ b/WebApplicationLesson1/Controllers/CalculatorController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace WebApplicationLesson1.Controllers +{ + public class CalculatorController : Controller + { + public string Index(int num1, int num2) + { + return $"{num1} + {num2} = {num1 + num2}"; + } + } +} diff --git a/WebApplicationLesson1/Startup.cs b/WebApplicationLesson1/Startup.cs index d9a1eb0..4e2f31e 100644 --- a/WebApplicationLesson1/Startup.cs +++ b/WebApplicationLesson1/Startup.cs @@ -46,7 +46,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { endpoints.MapControllerRoute( name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + pattern: "{controller=Home}/{action=Index}/{num1?}/{num2?}"); }); } }