private bool IsKeyValid(TeachingAssignmentModel model)
        {
            if (!_exist.TeacherExists(model.TeacherID))
            {
                _resp.code = 404;
                _resp.messages.Add("Teacher not found");
                return(false);
            }

            if (!_exist.ClassExists(model.ClassID))
            {
                _resp.code = 404;
                _resp.messages.Add("Class not found");
                return(false);
            }

            if (!_exist.SubjectExists(model.SubjectID))
            {
                _resp.code = 404;
                _resp.messages.Add("Subject not found");
                return(false);
            }

            return(true);
        }
Пример #2
0
        private bool IsKeyValid(UpdateMarkModel model)
        {
            // check for student
            if (!_exist.StudentExists(model.StudentID))
            {
                resp.code = 404; // Not found
                resp.messages.Add("Student not found");
            }

            // check for subject
            if (!_exist.SubjectExists(model.SubjectID))
            {
                resp.code = 404; // Not found
                resp.messages.Add("Subject not found");
            }

            // check for semester
            if (!_exist.SemesterExists(model.SemesterID))
            {
                resp.code = 404; // Not found
                resp.messages.Add("Semester not found");
            }

            // check for result type
            if (!_exist.ResultTypeExists(model.ResultTypeID))
            {
                resp.code = 404; // Not found
                resp.messages.Add("Result Type not found");
            }

            return(true);
        }