public string AddNewTeacher(string Name, string Surname, string PassportNomber, int IdSchool) { if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Surname) || string.IsNullOrEmpty(PassportNomber)) { return("All Informations Of Teacher Not Allow To be Empty"); } else { if (_dalschool.IsExist(IdSchool)) { if (!_dal.IsExist(Name, Surname)) { var teacher = Teacher.CreaTeacher(Name, Surname, PassportNomber); _dal.AddNewTeacher(teacher); var School = _dalschool.GetSchool(IdSchool); _dal.AddNewTeacherSchool(TeacherSchool.CreaTeacherSchool(School, teacher)); return("true"); } else { return("This Teacher Is Exist Before"); } } else { return("This School Is Not Exist "); } } }
public string AddSchool(string Name, string Address, string City, string District) { if (!string.IsNullOrEmpty(Name)) { if (!_dal.IsExist(Name)) { _dal.AddSchool(School.CreateStudent(Name, Address, City, District)); return("true"); } else { return("This School Is Exist Before"); } } else { return("The Name Of School Not Allow To be Empty"); } }
public string AddNewListStudents(List <DataAPI> dataAPIs) { var ErrorStrng = ""; foreach (var item in dataAPIs) { if (string.IsNullOrEmpty(item.Name) || string.IsNullOrEmpty(item.Surname) || string.IsNullOrEmpty(item.PassportNomber)) { ErrorStrng += "All Informations Of Student Not Allow To be Empty in Item No :" + item.IdItem + " __ "; } else { if (_dalschool.IsExist(item.IdSchool)) { if (!_dal.IsExist(item.Name, item.Surname)) // Not Allow to be more than one Student in same name in DB { var School = _dalschool.GetSchool(item.IdSchool); _dal.AddNewStudent(Student.CreatStudent(item.Name, item.Surname, item.PassportNomber, School)); } else { ErrorStrng += "This Student Is Exist Before in Item No :" + item.IdItem + " __ "; } } else { ErrorStrng += "This School Is Not Exist in Item No :" + item.IdItem + " __ "; } } } if (ErrorStrng == "") { ErrorStrng = "true";// All Informations is Saved } return(ErrorStrng); }