diff --git a/WebApplicationLesson1/Controllers/CalculatorController.cs b/WebApplicationLesson1/Controllers/CalculatorController.cs new file mode 100644 index 0000000..23472d9 --- /dev/null +++ b/WebApplicationLesson1/Controllers/CalculatorController.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace WebApplicationLesson1.Controllers +{ + public class CalculatorController : Controller + { + public string Index(int a, int b) + { + return $"{a} + {b} = {a + b}"; + } + } +} \ No newline at end of file diff --git a/WebApplicationLesson1/Startup.cs b/WebApplicationLesson1/Startup.cs index d9a1eb0..f3a790a 100644 --- a/WebApplicationLesson1/Startup.cs +++ b/WebApplicationLesson1/Startup.cs @@ -3,10 +3,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebApplicationLesson1 { @@ -45,8 +41,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + name: "default", + pattern: "{controller=Home}/{action=Index}/{a?}/{b?}"); }); } }