очеень малелькая прака

This commit is contained in:
Володя 2023-05-20 09:24:40 +03:00
parent 200d4af5d9
commit a4cfde7aff
2 changed files with 24 additions and 6 deletions

View File

@ -259,6 +259,8 @@ namespace StudentWebClient.Controllers
{ {
throw new Exception("Введите название и описане"); throw new Exception("Введите название и описане");
} }
if(interests.Length == 0)
throw new Exception("Выберите интересы");
Dictionary<int, IInterest> diyInterests = new Dictionary<int, IInterest>(); Dictionary<int, IInterest> diyInterests = new Dictionary<int, IInterest>();
foreach(int id in interests) foreach(int id in interests)
{ {
@ -309,6 +311,8 @@ namespace StudentWebClient.Controllers
{ {
throw new Exception("Нет задания"); throw new Exception("Нет задания");
} }
if (interests.Length == 0)
throw new Exception("Выберите интересы");
Dictionary<int, IInterest> diyInterests = new Dictionary<int, IInterest>(); Dictionary<int, IInterest> diyInterests = new Dictionary<int, IInterest>();
@ -369,6 +373,8 @@ namespace StudentWebClient.Controllers
{ {
throw new Exception("Введите название и описане"); throw new Exception("Введите название и описане");
} }
if (interests.Length == 0)
throw new Exception("Выберите интересы");
Dictionary<int, IInterest> productInterests = new Dictionary<int, IInterest>(); Dictionary<int, IInterest> productInterests = new Dictionary<int, IInterest>();
foreach (int id in interests) foreach (int id in interests)
{ {
@ -412,7 +418,8 @@ namespace StudentWebClient.Controllers
{ {
throw new Exception("Нет даты"); throw new Exception("Нет даты");
} }
if (interests.Length == 0)
throw new Exception("Выберите интересы");
Dictionary<int, IInterest> productInterests = new Dictionary<int, IInterest>(); Dictionary<int, IInterest> productInterests = new Dictionary<int, IInterest>();
foreach (int id in interests) foreach (int id in interests)

View File

@ -252,11 +252,15 @@ namespace TeacherWebClient.Controllers
{ {
throw new Exception("Введите название и дату"); throw new Exception("Введите название и дату");
} }
if (materials.Length == 0)
throw new Exception("Выберите материалы");
Dictionary<int, IMaterial> lessonMaterials = new Dictionary<int, IMaterial>(); Dictionary<int, IMaterial> lessonMaterials = new Dictionary<int, IMaterial>();
foreach (int id in materials) foreach (int id in materials)
{ {
lessonMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); lessonMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id }));
} }
_lesson.Create(new LessonBindingModel _lesson.Create(new LessonBindingModel
{ {
TeacherId = APIClient.Teacher.Id, TeacherId = APIClient.Teacher.Id,
@ -297,6 +301,8 @@ namespace TeacherWebClient.Controllers
{ {
throw new Exception("Нет изделия"); throw new Exception("Нет изделия");
} }
if (materials.Length == 0)
throw new Exception("Выберите материалы");
Dictionary<int, IMaterial> lessonMaterials = new Dictionary<int, IMaterial>(); Dictionary<int, IMaterial> lessonMaterials = new Dictionary<int, IMaterial>();
foreach (int id in materials) foreach (int id in materials)
@ -359,6 +365,9 @@ namespace TeacherWebClient.Controllers
{ {
throw new Exception("Дата выдачи должна быть раньше срока сдачи"); throw new Exception("Дата выдачи должна быть раньше срока сдачи");
} }
if (materials.Length == 0)
throw new Exception("Выберите материалы");
Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>(); Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>();
foreach (int id in materials) foreach (int id in materials)
{ {
@ -406,6 +415,8 @@ namespace TeacherWebClient.Controllers
{ {
throw new Exception("Дата выдачи должна быть раньше срока сдачи"); throw new Exception("Дата выдачи должна быть раньше срока сдачи");
} }
if (materials.Length == 0)
throw new Exception("Выберите материалы");
Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>(); Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>();
foreach (int id in materials) foreach (int id in materials)