@page "/addproduct"
@using proevi.Models
@using proevi.Services

@inject ProductService service
@inject NavigationManager navigationManager
@inject IJSRuntime js


<h3>AddProduct</h3>
<Entry OnValidSubmit="Onsubmit" ProductCategory="productCategoryDTO"></Entry>

@code {
	public ProductCategoryDTO productCategoryDTO = new ProductCategoryDTO();

	public async void Onsubmit()
	{
		var response = await service.Add(productCategoryDTO);
		if (response.IsSuccessStatusCode)
		{
			navigationManager.NavigateTo("/productlist");
		}
		else
		{
			js.InvokeAsync<string>("alert", response.ReasonPhrase);
		}
	}

}
