public int AddCourse(Domain.Course newCourse) { ICourseDao courseDao = new CourseDao(sessionFactory); try { Course havedCourse=courseDao.GetCourseByTeacherIDAndName(newCourse.courseTeacherID,newCourse.courseName); if (havedCourse == null) { int courseId = (Int32)courseDao.Save(newCourse); return courseId; } else { return 0; } }catch (Exception e) { return 0; } }