private void CreateAddress() { var address = new Address { Email = "*****@*****.**", UnsubscribeToken = Guid.NewGuid().ToString(), Subscribed = true }; var addressTopic = new AddressTopic { Address = address, TopicId = 1 }; _context.Addresses.Add(address); _context.AddressTopic.Add(addressTopic); _context.SaveChanges(); }
public static bool TryGetTopic(JSON.API.Internals.Topic topic, IEnumerable <string> symbols, out Topic topicResult) { try { if (topic is JSON.API.Internals.AddressTopic address) { topicResult = new AddressTopic(new Address(address.Address)); } else if (topic is JSON.API.Internals.LedgerTopic) { topicResult = new LedgerTopic(); } else if (topic is JSON.API.Internals.OrderBookTopic orderBook) { if (!symbols.Contains(orderBook.Symbol)) { topicResult = null; return(false); } topicResult = new OrderBookTopic(orderBook.Symbol); } else if (topic is JSON.API.Internals.TransactionTopic transaction) { topicResult = new TransactionTopic(new TransactionHash(Convert.FromBase64String(transaction.Hash))); } else if (topic is JSON.API.Internals.FundsTopic) { topicResult = new FundsTopic(); } else { throw new NotImplementedException(); } return(true); } catch (Exception e) { topicResult = null; return(false); } }