Example #1
0
        public virtual async Task <ModuleDto> CreateAsync(ModuleCreateDto input)
        {
            var module = ObjectMapper.Map <ModuleCreateDto, Module>(input);

            var moduleExist = await ModuleRepository.GetByCodeAsync(input.Code);

            if (moduleExist?.Id > 0)
            {
                throw new BusinessException(code: MasterDataErrorCodes.Module.CodeExists)
                      .WithData("Code", input.Code);
            }

            module = await ModuleRepository.InsertAsync(module);

            return(ObjectMapper.Map <Module, ModuleDto>(module));
        }
Example #2
0
 public async Task <ModuleDto> CreateAsync(ModuleCreateDto input)
 {
     return(await ModuleAppService.CreateAsync(input));
 }