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