public async Task <IActionResult> DeleteAsync(int id) { try { await _customerService.DeleteAsync(id); return(NoContent()); } catch (EntityNotFoundException ex) { return(NotFound(new ApiResponse <string>(ex.Message))); } catch (Exception ex) { return(Ok(new ApiResponse <string>(ex.Message))); } }
/// <summary> /// Deletes an operation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='providerNamespace'> /// The name of the resource provider hosted within ProviderHub. /// </param> public static void Delete(this IOperations operations, string providerNamespace) { operations.DeleteAsync(providerNamespace).GetAwaiter().GetResult(); }
/// <summary> /// Removes the specified key. A key is ignored if it does not exist. /// </summary> /// <param name="key">The key of the object.</param> /// <returns></returns> public Task <bool> DeleteAsync(string key) { return(_operations.DeleteAsync(key)); }