From a4cfde7aff385c371ffac8fe7f694372d2e41ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Sat, 20 May 2023 09:24:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=87=D0=B5=D0=B5=D0=BD=D1=8C=20=D0=BC?= =?UTF-8?q?=D0=B0=D0=BB=D0=B5=D0=BB=D1=8C=D0=BA=D0=B0=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 11 +++++++++-- .../Controllers/HomeController.cs | 19 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs index 098c9d0..3fc66cb 100644 --- a/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs +++ b/SchoolAgainStudy/StudentWebClient/Controllers/HomeController.cs @@ -259,6 +259,8 @@ namespace StudentWebClient.Controllers { throw new Exception("Введите название и описане"); } + if(interests.Length == 0) + throw new Exception("Выберите интересы"); Dictionary diyInterests = new Dictionary(); foreach(int id in interests) { @@ -309,7 +311,9 @@ namespace StudentWebClient.Controllers { throw new Exception("Нет задания"); } - + if (interests.Length == 0) + throw new Exception("Выберите интересы"); + Dictionary diyInterests = new Dictionary(); foreach (int id in interests) @@ -369,6 +373,8 @@ namespace StudentWebClient.Controllers { throw new Exception("Введите название и описане"); } + if (interests.Length == 0) + throw new Exception("Выберите интересы"); Dictionary productInterests = new Dictionary(); foreach (int id in interests) { @@ -412,7 +418,8 @@ namespace StudentWebClient.Controllers { throw new Exception("Нет даты"); } - + if (interests.Length == 0) + throw new Exception("Выберите интересы"); Dictionary productInterests = new Dictionary(); foreach (int id in interests) diff --git a/SchoolAgainStudy/TeacherWebClient/Controllers/HomeController.cs b/SchoolAgainStudy/TeacherWebClient/Controllers/HomeController.cs index 77aa178..8da7bf6 100644 --- a/SchoolAgainStudy/TeacherWebClient/Controllers/HomeController.cs +++ b/SchoolAgainStudy/TeacherWebClient/Controllers/HomeController.cs @@ -252,11 +252,15 @@ namespace TeacherWebClient.Controllers { throw new Exception("Введите название и дату"); } - Dictionary lessonMaterials = new Dictionary(); + if (materials.Length == 0) + throw new Exception("Выберите материалы"); + + Dictionary lessonMaterials = new Dictionary(); foreach (int id in materials) { lessonMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); } + _lesson.Create(new LessonBindingModel { TeacherId = APIClient.Teacher.Id, @@ -297,8 +301,10 @@ namespace TeacherWebClient.Controllers { throw new Exception("Нет изделия"); } + if (materials.Length == 0) + throw new Exception("Выберите материалы"); - Dictionary lessonMaterials = new Dictionary(); + Dictionary lessonMaterials = new Dictionary(); foreach (int id in materials) { lessonMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); @@ -359,7 +365,10 @@ namespace TeacherWebClient.Controllers { throw new Exception("Дата выдачи должна быть раньше срока сдачи"); } - Dictionary taskMaterials = new Dictionary(); + if (materials.Length == 0) + throw new Exception("Выберите материалы"); + + Dictionary taskMaterials = new Dictionary(); foreach (int id in materials) { taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); @@ -406,8 +415,10 @@ namespace TeacherWebClient.Controllers { throw new Exception("Дата выдачи должна быть раньше срока сдачи"); } + if (materials.Length == 0) + throw new Exception("Выберите материалы"); - Dictionary taskMaterials = new Dictionary(); + Dictionary taskMaterials = new Dictionary(); foreach (int id in materials) { taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id }));