public ProductPresenter(IProductView view) { productMapper = new ProductMapper(); deliveryTypeMapper = new DeliveryTypeMapper(); _unitOFWork = new UnitOfWork(new ApplicationContext()); _productService = new ProductService(_unitOFWork); _deliveryTypeService = new DeliveryTypeService(_unitOFWork); deliveryTypes = _deliveryTypeService.GetAllDeliveryTypes().Select(delType => deliveryTypeMapper.FromDomainToModel(delType)).ToList(); products = _productService.GetAllProducts().Select(prod => productMapper.FromDomainToModel(prod)).ToList(); _view = view; _view.DisplayData(deliveryTypes, products); _view.ProductSelected += SelectTheProduct; _view.CategorySelected += RebuildCategoryTable; _view.textChanged += FindByText; _view.parametersChanged += FindByParameters; //this.initialize(); }
//public void initialize() { // _view.CategorySelected += RebuildCategoryTable; //_view.ProductSelected += SelectTheProduct; //} public void FindByText() { _view.DisplayData(deliveryTypes, _productService.FindByText(_view.InsertedText).Select(prod => productMapper.FromDomainToModel(prod)).ToList()); }