From dcbac9d4cc1ff19ef32accb879ca302e9ecb9e7c Mon Sep 17 00:00:00 2001 From: MarikBiragov <121573561+MarikBiragov@users.noreply.github.com> Date: Sun, 31 Mar 2024 16:39:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B4=D0=BE=D0=BB=D0=B6?= =?UTF-8?q?=D0=B0=D1=8E=20=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=20=D0=A1?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalculatorController1.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 WebApplicationLesson1/Controllers/CalculatorController1.cs diff --git a/WebApplicationLesson1/Controllers/CalculatorController1.cs b/WebApplicationLesson1/Controllers/CalculatorController1.cs new file mode 100644 index 0000000..c71f0c0 --- /dev/null +++ b/WebApplicationLesson1/Controllers/CalculatorController1.cs @@ -0,0 +1,33 @@ +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