internal static async Task <TResult> FindByMethodAndKeyAsync <TResult>(IRef <Method> authenticationId, string authorizationKey, Authorization authorization, Func <Guid, TResult> onFound, Func <TResult> onNotFound) { var lookupRef = AccountMappingLookup.GetLookup(authenticationId, authorizationKey); return(await await lookupRef.StorageGetAsync( lookup => { return lookup.accountMappingId.StorageGetAsync( accountMapping => onFound(accountMapping.accountId), () => onNotFound()); }, async() => { var accountMappingRef = new Ref <AuthorizationLookup>(authorization.id); return await await accountMappingRef.StorageGetAsync( lookup => { return lookup.accountMappingRef.StorageGetAsync( accountMapping => onFound(accountMapping.accountId), () => onNotFound()); }, () => onNotFound().AsTask()); })); }
public static async Task <TResult> DeleteByMethodAndKeyAsync <TResult>(IRef <Method> authenticationId, string authorizationKey, Func <Guid, TResult> onFound, Func <TResult> onNotFound) { var lookupRef = AccountMappingLookup.GetLookup(authenticationId, authorizationKey); return(await await lookupRef.StorageDeleteAsync( lookup => { return lookup.accountMappingId.StorageDeleteAsync( accountMapping => onFound(accountMapping.accountId), () => onNotFound()); }, () => onNotFound().AsTask())); }