Exemplo n.º 1
0
        public int AssaignCourseTeacher(Teacher teacher)
        {
            int assaigned = 0;

            if (anTeacherGateway.IsCourseAssaigned(teacher))
            {
                assaigned = 2;
            }
            else
            {
                int isRowAffected = anTeacherGateway.AssaignCourseTeacher(teacher);
                if (isRowAffected > 0)
                {
                    double remain = teacher.CreditLeft - teacher.Credit;
                    anTeacherGateway.UpdateTeacherCredit(remain, teacher.Id);
                    assaigned = 1;
                }
                else
                {
                    assaigned = 2;
                }
            }

            return(assaigned);
        }