public void Create(CreateRoleUICommand command) { if (_systemRoleRepository.GetAll(x => x.Name == command.Name && !x.IsDeleted).Any()) { throw new DomainException(ErrorMessage.RoleNameIsExist); } var systemRole = SystemRole.Create(command.Name, command.Description, new Guid(), _timeSource.LocalNow()); using (var unitOfWork = _unitOfWorkFactory.GetCurrentUnitOfWork()) { _systemRoleRepository.Add(systemRole); unitOfWork.Commit(); } }
public IEnumerable <SystemRoleDTO> GetAllRoles() { var roles = systemRoleRepository.GetAll().AsEnumerable(); return(AutoMapper.Mapper.Map <IEnumerable <SystemRoleDTO> >(roles)); }