public void RemoveRegistrationTicket(Guid id) { var key = PrefixConstants.GetRegistrationTicketKey(id); byte[] bytesKey = Encoding.UTF8.GetBytes(key); try { _database.Delete(bytesKey); } catch (Exception e) { _logger.Error(e, $"Failed to write registration ticket {id}"); } }
public void WriteRegistrationTicket(RegisterTicketEntity ticket) { var key = PrefixConstants.GetRegistrationTicketKey(ticket.Id); byte[] bytesKey = Encoding.UTF8.GetBytes(key); string stringValue = JsonSerializer.Serialize(ticket); byte[] bytesValue = Encoding.UTF8.GetBytes(stringValue); try { _database.Put(bytesKey, bytesValue); } catch (Exception e) { _logger.Error(e, $"Failed to write registration ticket {ticket.Id}"); } }
public RegisterTicketEntity ReadRegistrationTicket(Guid id) { var key = PrefixConstants.GetRegistrationTicketKey(id); byte[] bytesKey = Encoding.UTF8.GetBytes(key); try { bool isRead = _database.TryRead(bytesKey, out byte[] value); if (!isRead) { throw new ServerDatabaseException("Failed to read ticket info"); } return(JsonSerializer.Deserialize <RegisterTicketEntity>(Encoding.UTF8.GetString(value))); } catch (Exception e) { _logger.Error(e, $"Failed to read registration ticket {id}"); } return(null); }