Ejemplo n.º 1
0
        public Operation <BitcoinAddress> AddBitcoindAddress(BitcoinAddress address)
        => _authorizer.AuthorizeAccess(UserContext.CurrentPPP(), () =>
        {
            if (address == null || address.Id != 0)
            {
                throw new Exception("Invalid bit address given");
            }
            else if (_query.AddressExists(address.BlockChainAddress))
            {
                throw new Exception("This address has already been used");
            }
            else
            {
                return(address.With(new { OwnerId = UserContext.CurrentUser().UserId }).Validate()
                       .Then(opr =>
                {
                    address.IsVerified = false;
                    address.IsActive = false;

                    return _pcommand.Add(address);
                }));
            }
        });