From 14b054091d00722b5752706fed223ab1603317b7 Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Wed, 3 Apr 2024 23:18:36 +0300 Subject: [PATCH 1/6] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5?= =?UTF-8?q?=D1=80=20start=20=D0=B8=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20hell?= =?UTF-8?q?o=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D1=8F=D1=82=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F?= =?UTF-8?q?=20=D0=B2=20=D0=BC=D0=BE=D0=BC=D0=B5=D0=BD=D1=82=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=BC=D1=83=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StartController1.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 WebApplicationLesson1/Controllers/StartController1.cs diff --git a/WebApplicationLesson1/Controllers/StartController1.cs b/WebApplicationLesson1/Controllers/StartController1.cs new file mode 100644 index 0000000..f2946a4 --- /dev/null +++ b/WebApplicationLesson1/Controllers/StartController1.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using System; + +namespace WebApplicationLesson1.Controllers +{ + public class StartController1 : Controller + { + public string hello() + { + var time = DateTime.Now.Hour; + if (time < 6) + { + return "Доброй ночи"; + } + if (time < 12) + { + return "Доброе утро"; + } + if (time < 18) + { + return "Добрый день"; + } + return "Добрый вечер"; + } + } +} From 6d75dd3a5267adeaf94f0c21a765d3ed9f2d821f Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Wed, 3 Apr 2024 23:34:20 +0300 Subject: [PATCH 2/6] Dzboeva_Zalina_1_2 --- .../Controllers/CalculatorController1.cs | 17 ++++++++++++ .../Controllers/StartController1.cs | 26 ------------------- WebApplicationLesson1/Startup.cs | 2 +- 3 files changed, 18 insertions(+), 27 deletions(-) create mode 100644 WebApplicationLesson1/Controllers/CalculatorController1.cs delete mode 100644 WebApplicationLesson1/Controllers/StartController1.cs diff --git a/WebApplicationLesson1/Controllers/CalculatorController1.cs b/WebApplicationLesson1/Controllers/CalculatorController1.cs new file mode 100644 index 0000000..85f39f0 --- /dev/null +++ b/WebApplicationLesson1/Controllers/CalculatorController1.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace WebApplication1.Controllers +{ + public class CalculatorController1 : Controller + { + public class CalculatorController : Controller + { + public string Index(int a, int b) + { + return $"{a} + {b} = {a + b}"; + } + } + + } +} diff --git a/WebApplicationLesson1/Controllers/StartController1.cs b/WebApplicationLesson1/Controllers/StartController1.cs deleted file mode 100644 index f2946a4..0000000 --- a/WebApplicationLesson1/Controllers/StartController1.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; - -namespace WebApplicationLesson1.Controllers -{ - public class StartController1 : Controller - { - public string hello() - { - var time = DateTime.Now.Hour; - if (time < 6) - { - return "Доброй ночи"; - } - if (time < 12) - { - return "Доброе утро"; - } - if (time < 18) - { - return "Добрый день"; - } - return "Добрый вечер"; - } - } -} diff --git a/WebApplicationLesson1/Startup.cs b/WebApplicationLesson1/Startup.cs index d9a1eb0..0c855a8 100644 --- a/WebApplicationLesson1/Startup.cs +++ b/WebApplicationLesson1/Startup.cs @@ -46,7 +46,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { endpoints.MapControllerRoute( name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + pattern: "{controller=Home}/{action=Index}/{a?}/{b?}"); }); } } From aec384680e25a6088dbda4b755e73a729883a20d Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Wed, 3 Apr 2024 23:41:17 +0300 Subject: [PATCH 3/6] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=B0=D0=BB=D1=8C=D0=BA=D1=83=D0=BB=D1=8F=D1=82?= =?UTF-8?q?=D0=BE=D1=80=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB?= =?UTF-8?q?=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebApplicationLesson1/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApplicationLesson1/Startup.cs b/WebApplicationLesson1/Startup.cs index 0c855a8..4beba87 100644 --- a/WebApplicationLesson1/Startup.cs +++ b/WebApplicationLesson1/Startup.cs @@ -46,7 +46,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { endpoints.MapControllerRoute( name: "default", - pattern: "{controller=Home}/{action=Index}/{a?}/{b?}"); + pattern: "{controller=Home}/{action=Index}/{a?}/{b?}"); }); } } From 31149d0b557bbe0a2f070e4321bf9417f132de73 Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Wed, 3 Apr 2024 23:52:15 +0300 Subject: [PATCH 4/6] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=B5=D1=80=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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalculatorController1.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/WebApplicationLesson1/Controllers/CalculatorController1.cs b/WebApplicationLesson1/Controllers/CalculatorController1.cs index 85f39f0..7bf64d9 100644 --- a/WebApplicationLesson1/Controllers/CalculatorController1.cs +++ b/WebApplicationLesson1/Controllers/CalculatorController1.cs @@ -3,15 +3,11 @@ namespace WebApplication1.Controllers { - public class CalculatorController1 : Controller + public class CalculatorController : Controller { - public class CalculatorController : Controller + public string Index(int a, int b) { - public string Index(int a, int b) - { - return $"{a} + {b} = {a + b}"; - } + return $"{a} + {b} = {a + b}"; } - } } From 45d4e63ca805b8e3dbe17b25c9c1c9d47ee3dfea Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Thu, 4 Apr 2024 00:03:50 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalculatorController1.cs | 11 +++++++++-- WebApplicationLesson1/Startup.cs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/WebApplicationLesson1/Controllers/CalculatorController1.cs b/WebApplicationLesson1/Controllers/CalculatorController1.cs index 7bf64d9..14521e1 100644 --- a/WebApplicationLesson1/Controllers/CalculatorController1.cs +++ b/WebApplicationLesson1/Controllers/CalculatorController1.cs @@ -5,9 +5,16 @@ namespace WebApplication1.Controllers { public class CalculatorController : Controller { - public string Index(int a, int b) + public string Index(int a, int b, string c = "+") { - return $"{a} + {b} = {a + b}"; + if (c == "+") + return $"{a} + {b} = {a + b}"; + + if (c == "-") + return $"{a} - {b} = {a - b}"; + if (c == "*") + return $"{a} * {b} = {a * b}"; + return "Ошибка операции"; } } } diff --git a/WebApplicationLesson1/Startup.cs b/WebApplicationLesson1/Startup.cs index 4beba87..007d4b6 100644 --- a/WebApplicationLesson1/Startup.cs +++ b/WebApplicationLesson1/Startup.cs @@ -46,7 +46,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { endpoints.MapControllerRoute( name: "default", - pattern: "{controller=Home}/{action=Index}/{a?}/{b?}"); + pattern: "{controller=Home}/{action=Index}/{a?}/{b?}/{c?}"); }); } } From a2f3253ccbb73dbd4dfb4f8c00ce86b2cb1349b9 Mon Sep 17 00:00:00 2001 From: "zalina.dzboeva@outlook.com" Date: Thu, 4 Apr 2024 00:07:56 +0300 Subject: [PATCH 6/6] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=BE=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CalculatorController1.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/WebApplicationLesson1/Controllers/CalculatorController1.cs b/WebApplicationLesson1/Controllers/CalculatorController1.cs index 14521e1..4a19605 100644 --- a/WebApplicationLesson1/Controllers/CalculatorController1.cs +++ b/WebApplicationLesson1/Controllers/CalculatorController1.cs @@ -5,16 +5,17 @@ namespace WebApplication1.Controllers { public class CalculatorController : Controller { - public string Index(int a, int b, string c = "+") + public string Index(int a, int b, string c ) { - if (c == "+") - return $"{a} + {b} = {a + b}"; - if (c == "-") - return $"{a} - {b} = {a - b}"; - if (c == "*") - return $"{a} * {b} = {a * b}"; + if(c== "+") + return $"{a} + {b} = {a + b}"; + + if(c=="-") + return $"{a} - {b} = {a - b}"; + if(c == "*") + return $"{a} * {b} = {a * b}"; + return "Ошибка операции"; } - } }