public void Update(IList <ProductViewModel> productList) { ProductListRequestImpl productListRequest = new ProductListRequestImpl(); productListRequest.CustomerType = _productListView.CustomerType; ProductListResponseImpl productResponse = _productService.UpdateProductsFor(productListRequest, productList); if (productResponse != null && productResponse.Success) { _productListView.Display((IList <ProductViewModel>)productList); } else { _productListView.ErrorMessage = productResponse.Message; } }
public ProductListResponseImpl UpdateProductsFor(ProductListRequestImpl request, IList <ProductViewModel> productList) { ProductListResponseImpl _response = new ProductListResponseImpl(); Repository.Products.ProductService _server = new Repository.Products.ProductService(new ProductRepositoryImpl()); try { bool _result = _server.UpdateProductsFor(request.CustomerType, productList.ConvertToProductList()); _response.Success = true; _response.Message = string.Empty; _response.Context = _result; } catch (Exception e) { _response.Success = false; _response.Message = e.Message; _response.Context = null; } return(_response); }
public ProductListResponseImpl GetAllProductsFor(ProductListRequestImpl request) { ProductListResponseImpl _response = new ProductListResponseImpl(); Repository.Products.ProductService _server = new Repository.Products.ProductService(new ProductRepositoryImpl()); try { IList <Product> _productList = _server.GetAllProductsFor(request.CustomerType); IList <ProductViewModel> _list = _productList.ConvertToProductListViewModel(); _response.Success = true; _response.Message = string.Empty; _response.Context = _list; } catch (Exception e) { _response.Success = false; _response.Message = e.Message; _response.Context = null; } return(_response); }