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

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,7 +311,9 @@ 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)
@ -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("Введите название и дату");
} }
Dictionary<int, IMaterial> lessonMaterials = new Dictionary<int, IMaterial>(); if (materials.Length == 0)
throw new Exception("Выберите материалы");
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,8 +301,10 @@ 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 }));
@ -359,7 +365,10 @@ namespace TeacherWebClient.Controllers
{ {
throw new Exception("Дата выдачи должна быть раньше срока сдачи"); throw new Exception("Дата выдачи должна быть раньше срока сдачи");
} }
Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>(); if (materials.Length == 0)
throw new Exception("Выберите материалы");
Dictionary<int, IMaterial> taskMaterials = new Dictionary<int, IMaterial>();
foreach (int id in materials) foreach (int id in materials)
{ {
taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id }));
@ -406,8 +415,10 @@ 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)
{ {
taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id })); taskMaterials.Add(id, _material.ReadElement(new MaterialSearchModel { Id = id }));