public ProductOperations(IProductView view, DataAccessProduct productData) { this.view = view; this.productData = productData; var products = productData.RetrieveProduct(); this.view.LoadProduct(products); view.Add += () => { var p = view.AddProduct(); productData.AddProduct(p); }; view.Updatee += () => { var p = view.UpdateProduct(); productData.UpdateProduct(p); }; view.Deletee += () => { var p = view.DeleteProduct(); productData.DeleteProduct(p); }; view.Ret += () => { products = productData.RetrieveProduct(); this.view.LoadProduct(products); }; }
private void ProductCommands(string input) { if (input.Contains(Add)) { _productView.AddProduct(); } if (input.Contains(Update)) { _productView.UpdateProduct(); } if (input.Contains(Delete)) { _productView.DeleteProduct(); } if (input.Contains(One)) { _productView.GetProduct(); } if (input.Contains(All)) { _productView.GetProducts(); } if (input.Contains(Search)) { _productView.SearchProducts(); } if (input.Contains(AddPerson)) { _productView.AddPerson(); } if (input.Contains(RemovePerson)) { _productView.RemovePerson(); } }