private string GenerateProductsModelAsStringJson(SearchProductsViewModel searchProductsViewModel) { string arrayProducts = ""; List <ProductsSearchModel> productsSearchModel; productsSearchModel = new List <ProductsSearchModel> (); if (searchProductsViewModel.code == PRODUCT_AVAILABLE_CODE) { foreach (var single in searchProductsViewModel.data) { ProductsSearchModel productSearch = new ProductsSearchModel(); productSearch.value = single.productPartNumber; productSearch.data = single.productId.ToString(); productsSearchModel.Add(productSearch); } arrayProducts = JsonConvert.SerializeObject(productsSearchModel); } else { arrayProducts = JsonConvert.SerializeObject(productsSearchModel); } return(arrayProducts); }
public ProductsPageViewModel(IProductsService productsService, IDialogService dialogService) { this.productsService = productsService; this.dialogService = dialogService; SearchModel = new ProductsSearchModel() { ProductNameContains = "" }; AddProductCommand = new RelayCommand(OpenProductCreationDialog); OpenProductForEditCommand = new RelayParameterizedCommand((product) => EditProduct(product as Product)); SearchCommand = new RelayCommand(Search); LoadData(); }
public async Task <FilteredResult <Product> > GetProducts(ProductsSearchModel request) { return(await apiConnector.GetAsync <FilteredResult <Product> >("products" + request.ToQueryString())); }