private void CreateNewProduct() { if (_modal is not null) { var product = new ProductDetails(); var faker = product.GetBogusFaker(); var fake = faker.Generate(); _modal.Product = product with { Id = fake.Id, ImageUrl = fake.ImageUrl, DetailsUrl = fake.DetailsUrl }; _modal.Open("Create Product", OnProductUpdated); } }
void CreateNewProduct() { if (_modal is not null) { var product = new ProductDetails(); var faker = product.GetBogusFaker(); var fake = faker.Generate(); _modal.Product = product with { Id = fake.Id, ImageUrl = fake.ImageUrl, DetailsUrl = fake.DetailsUrl }; _modal.Open(); } } async Task OnProductUpdated(ProductDetails product) { await ProductService.CreateOrUpdateProductAsync(product); _products = await InventoryService.GetAllProductsAsync(); _modal?.Close(); StateHasChanged(); } Task OnEditProduct(ProductDetails product) { if (_modal is not null) { _modal.Product = product; _modal.Open(); } return(Task.CompletedTask); } }