public static DepartmentLessonDomain Create(AddDepartmentLessonModel addDepartmentLessonModel)
        {
            return(new DepartmentLessonDomain(
                       addDepartmentLessonModel.LessonId,
                       addDepartmentLessonModel.DepartmentId

                       ));
        }
예제 #2
0
        public async Task <IDataResult <long> > AddAsync(AddDepartmentLessonModel addDepartmentLessonModel)
        {
            var validation = new AddDepartmentLessonModelValidator().Valid(addDepartmentLessonModel);

            if (!validation.Success)
            {
                return(new ErrorDataResult <long>(validation.Message));
            }

            var DepartmentLessonDomain = DepartmentLessonDomainFactory.Create(addDepartmentLessonModel);
            var DepartmentLessonEntity = DepartmentLessonDomain.Map <DepartmentLessonEntity>();
            await DepartmentLessonRepository.AddAsync(DepartmentLessonEntity);

            await DatabaseUnitOfWork.SaveChangesAsync();

            return(new SuccessDataResult <long>(DepartmentLessonEntity.DepartmentLessonId));
        }
        public async Task <IActionResult> AddAsync(AddDepartmentLessonModel addDepartmentLessonModel)
        {
            var result = await DepartmentLessonService.AddAsync(addDepartmentLessonModel);

            return(new ActionIResult(result));
        }