From 55a7f255f9a051300f04abca44075e934726c543 Mon Sep 17 00:00:00 2001 From: Saba Bestaev Date: Tue, 2 Apr 2024 15:24:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=BB=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalculatorController.cs | 16 ++++++++++++++++ WebApplicationLesson1/Startup.cs | 8 ++------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 WebApplicationLesson1/Controllers/CalculatorController.cs 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?}"); }); } }