/// <summary> /// Adds the AuditableProduct object specified by the product input parameter to the data source and updates its Id property asynchronously. /// </summary> /// <param name="product">The AuditableProduct object to add to the data source.</param> public Task <SetDataOperationResult> AddProductAsync(AuditableProduct product) { return(DataOperationManager.TrySetAsync(() => DataProvider.AddProduct(InitializeDataModel(product)), $"{product.Name} was added to the data source successfully", $"A problem occurred and {product.Name} was not added to the data source.")); }
/// <summary> /// Deletes the AuditableProduct object specified by the product input parameter from the data source asynchronously. /// </summary> /// <param name="product">The AuditableProduct object to remove from the data source.</param> /// <returns>A SetDataOperationResult object containing details relating to whether the operation was successful or not.</returns> public Task <SetDataOperationResult> DeleteProductAsync(AuditableProduct product) { return(DataOperationManager.TrySetAsync(() => DataProvider.DeleteProduct(DeleteDataModel(product)), $"{product.Name} has been deleted from the data source successfully.", $"A problem occurred and {product.Name} was not deleted from the data source.", true, false)); }