/// <summary> /// Asynchronously disapproves the <see cref="User" /> in the system. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns>True if <see cref="User" /> is disapproved, false otherwise.</returns> public virtual Task <bool> DisapproveUserAsync(string userName) { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(client.DeleteAsync(client.GetApiUrl(String.Format("{0}/disapprove/{{0}}", ModuleRelativePath), userName))); } }
/// <summary> /// Asynchronously deletes the <see cref="User" /> from the system. /// </summary> /// <param name="id">The identifier.</param> /// <returns>True if <see cref="User" /> is deleted, false otherwise.</returns> public virtual Task <bool> DeleteAsync(object id) { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(client.DeleteAsync(client.GetApiUrl(String.Format("{0}/{{0}}", ModuleRelativePath), id))); } }
/// <summary> /// Asynchronously disconnects social login provider from the <see cref="User" /> in the system. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="providerName">Name of the provider.</param> /// <returns>True if <see cref="User" /> is disconnected from social login provider, false otherwise.</returns> public virtual Task <bool> DisconnectSNProviderAsync(string userName, string providerName) { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(client.DeleteAsync(client.GetApiUrl(String.Format("{0}/social-login/{{0}}/{{1}}", ModuleRelativePath), userName, providerName))); } }
/// <summary> /// Asynchronously deletes the <see cref="Navigation" /> from the system. /// </summary> /// <param name="id">The identifier.</param> /// <returns>True if <see cref="Navigation" /> is deleted, false otherwise.</returns> public virtual async Task <bool> DeleteAsync(object id) { try { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(await client.DeleteAsync(client.GetApiUrl(String.Format("{0}/{{0}}", ModuleRelativePath), id))); } } catch (BaasicClientException ex) { if (ex.ErrorCode == (int)HttpStatusCode.NotFound) { return(false); } throw; } catch (Exception) { throw; } }
/// <summary> /// Asynchronously deletes the collection <see cref="Navigation" /> from the system. /// </summary> /// <param name="ids">The collection of identifiers.</param> /// <returns>True if the collection <see cref="Navigation" /> is deleted, false otherwise.</returns> public virtual Task <bool> BulkDeleteAsync(object ids) { try { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(client.DeleteAsync(client.GetApiUrl(string.Format("{0}/batch", ModuleRelativePath)), ids)); } } catch (BaasicClientException ex) { if (ex.ErrorCode == (int)HttpStatusCode.NotFound) { return(Task.FromResult(false)); } throw; } catch (Exception) { throw; } }
/// <summary> /// Asynchronously disconnects social login provider from the <see cref="User" /> in the system. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="providerName">Name of the provider.</param> /// <returns>True if <see cref="User" /> is disconnected from social login provider, false otherwise.</returns> public virtual async Task <bool> DisconnectSNProviderAsync(string userName, string providerName) { try { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { return(await client.DeleteAsync(client.GetApiUrl(String.Format("{0}/social-login/{{0}}/{{1}}", ModuleRelativePath), userName, providerName))); } } catch (BaasicClientException ex) { if (ex.ErrorCode == (int)HttpStatusCode.NotFound) { return(false); } throw; } catch (Exception) { throw; } }
/// <summary> /// Asynchronously deletes the <see cref="FileEntry" /> from the system. /// </summary> /// <param name="id">The identifier.</param> /// <param name="fileFormat">The file format.</param> /// <returns>True if <see cref="FileEntry" /> is deleted, false otherwise.</returns> public virtual async Task <bool> DeleteAsync(object id, object fileFormat = null) { try { using (IBaasicClient client = BaasicClientFactory.Create(Configuration)) { UrlBuilder uriBuilder = new UrlBuilder(client.GetApiUrl(String.Format("{0}/unlink/{{0}}", ModuleRelativePath, id))); InitializeQueryStringPair(uriBuilder, "fileFormat", fileFormat); return(await client.DeleteAsync(uriBuilder.ToString())); } } catch (BaasicClientException ex) { if (ex.ErrorCode == (int)HttpStatusCode.NotFound) { return(false); } throw; } catch (Exception) { throw; } }