Skip to content

Instantly share code, notes, and snippets.

@Defcoq
Created June 6, 2021 15:41
Show Gist options
  • Save Defcoq/7dae4121482d76418c62931b8be4818e to your computer and use it in GitHub Desktop.
Save Defcoq/7dae4121482d76418c62931b8be4818e to your computer and use it in GitHub Desktop.
public class ProductListPresenter
{
private IProductListView _productListView;
private Service.ProductService _productService;
public ProductListPresenter(IProductListView ProductListView, Service.ProductService ProductService)
{
_productService = ProductService;
_productListView = ProductListView;
}
public void Display()
{
Service.ProductListRequest productListRequest = new Service.ProductListRequest();
productListRequest.CustomerType = _productListView.CustomerType;
Service.ProductListResponse productResponse = _productService.GetAllProductsFor(productListRequest);
if (productResponse.Success)
{
_productListView.Display(productResponse.Products);
}
else
{
_productListView.ErrorMessage = productResponse.Message;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment