public async Task HandleAsync(CreateUserCommand command) { var user = await _swizzerContext.Users.FirstOrDefaultAsync(x => x.Email == command.Email); if (user != null) { throw new SwizzerServerException(ErrorCode.InvalidParameter, $"{command.Email} already exist with ${user.Id}"); } user = _swizzerMapper.MapTo <User>(command); user.Salt = _seciurityService.GetSalt(); user.Hash = _seciurityService.GetHash(command.Password, user.Salt); await _swizzerContext.AddAsync(user); var dto = _swizzerMapper.MapTo <UserDto>(user); _cacheService.Set(dto); }
public bool AddToCache(string key, Value value) { return(service.Set(key, value)); }