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 }));