public async Task Add(RoleAddUICommand command) { if (_roleRepository.GetAll().Any(x => x.Name == command.Role.Name && !x.IsDeleted)) { throw new LogicServiceException(ErrorMessage.RoleNameIsExisted); } var role = Role.Create(command.Role.Name, command.Role.Memo, _userAuthenticationManager.CurrentUser.UserId, _timeSource.GetCurrentTime()); using var unitOfWork = _unitOfWorkFactory.GetCurrentUnitOfWork(); _roleRepository.Add(role); await unitOfWork.Commit(); }
public async Task Post([FromBody] RoleAddUICommand command) { await _roleLogicService.Add(command); }