From 276c3682f3f74361756fba0bd9c42a5cb33965b0 Mon Sep 17 00:00:00 2001 From: Mihailqwefr Date: Sun, 31 Mar 2024 17:32:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BB=D1=8C=D0=BA=D1=83=D0=BB=D1=8F=D1=82=D0=BE?= =?UTF-8?q?=D1=80=20=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalkaulatorController.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 WebApplicationLesson1/Controllers/CalkaulatorController.cs diff --git a/WebApplicationLesson1/Controllers/CalkaulatorController.cs b/WebApplicationLesson1/Controllers/CalkaulatorController.cs new file mode 100644 index 0000000..2e1cf27 --- /dev/null +++ b/WebApplicationLesson1/Controllers/CalkaulatorController.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Mvc; + +namespace WebApplicationLesson1.Controllers +{ + public class CalculatorController : Controller + { + public string Index(int a = 0, int b = 0, string c = "+") + { + switch (c) + { + case "+": + return $"{a} + {b} = {a + b}"; + case "-": + return $"{a} - {b} = {a - b}"; + case "*": + return $"{a} * {b} = {a * b}"; + case "/": + return $"{a} / {b} = {a / b}"; + default: + return "не по кону"; + } + } + } +} \ No newline at end of file