コード例 #1
0
        public bool CreateCourse(MasterCourseDto masterCourseDto)
        {
            var success = false;

            try
            {
                _unitOfWorkProvider.UnitOfWork.CreateTransaction();
                var course = new Master_Course
                {
                    CourseName = masterCourseDto.CourseName,
                    Active     = true
                };
                _unitOfWorkProvider.MasterfCourseRepository.Insert(course);
                _unitOfWorkProvider.UnitOfWork.Save();
                _unitOfWorkProvider.UnitOfWork.Commit();
                success = true;
            }
            catch (System.Exception)
            {
                _unitOfWorkProvider.UnitOfWork.Rollback();
            }
            return(success);
        }
コード例 #2
0
        public bool UpdateCourse(MasterCourseDto masterCourseDto)
        {
            var success = false;

            try
            {
                _unitOfWorkProvider.UnitOfWork.CreateTransaction();
                var course = _unitOfWorkProvider.MasterfCourseRepository.GetById(masterCourseDto.PK_ID);
                if (course != null)
                {
                    course.CourseName = masterCourseDto.CourseName;
                    course.Active     = masterCourseDto.Active;
                    _unitOfWorkProvider.MasterfCourseRepository.Update(course);
                    _unitOfWorkProvider.UnitOfWork.Save();
                    _unitOfWorkProvider.UnitOfWork.Commit();
                    success = true;
                }
            }
            catch (System.Exception)
            {
                _unitOfWorkProvider.UnitOfWork.Rollback();
            }
            return(success);
        }
コード例 #3
0
 public bool Update([FromBody] MasterCourseDto masterCourse)
 {
     return(_contentService.UpdateCourse(masterCourse));
 }