public Operation DeleteUnreferencedAddress(long id) => _authorizer.AuthorizeAccess(this.PermissionProfile(UserContext.CurrentUser()), () => { if (_query.IsReferencedAddress(UserContext.CurrentUser(), id)) { throw new Exception("Cannot delete a referenced address"); } var address = _query.GetBitcoinAddressById(id); _pcommand.Delete(address).Resolve(); });
public Operation <IEnumerable <UserData> > RemoveData(string[] names) => _authorizer.AuthorizeAccess(UserContext.CurrentProcessPermissionProfile(), () => { var user = UserContext.CurrentUser(); return(names.Select(_name => { var data = _query.GetUserData(user, _name); if (data == null) { return null; } else { return _pcommand.Delete(data).Resolve(); } }) .Where(_data => _data != null) .ToArray() .AsEnumerable()); });