protected void ucIDetail_ChildListInstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType)) { case InstanceTypes.Product: ProductFacade facade = new ProductFacade(uow); IFacadeUpdateResult <ProductData> result = facade.DeleteProduct(e.Instance.Id); e.IsSuccessful = result.IsSuccessful; if (result.IsSuccessful) { // Refresh data in session CurrentInstance.Products = facade.RetrieveProductsBySupplier(CurrentInstance.Id, new ProductConverter()); } else { // Deal with Update result ProcUpdateResult(result.ValidationResult, result.Exception); } break; } } }
private void TryToRemoveProduct() { Product productToBeDeleted = (Product)lstActualAvailableProducts.SelectedItem; productFacade.DeleteProduct(productToBeDeleted); ClearTextBoxes(); ShowSuccessMessage("Producto borrado correctamente!", "Éxito"); LoadProductsList(); }
public IActionResult deleteProduct(ProductModel product) { var deletedProduct = Facade.DeleteProduct(product); if (deletedProduct != null) { return(Ok()); } return(BadRequest()); }
// // GET: /Admin/Product/Delete/5 public ActionResult Delete(int id) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { ProductFacade facade = new ProductFacade(uow); IFacadeUpdateResult <ProductData> result = facade.DeleteProduct(id); if (result.IsSuccessful) { } else { // Deal with Update result ProcUpdateResult(result.ValidationResult, result.Exception); } } return(RedirectToAction(IndexAction)); }
protected void ucIList_InstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e) { using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey)) { ProductFacade facade = new ProductFacade(uow); IFacadeUpdateResult <ProductData> result = facade.DeleteProduct(e.Instance.Id); e.IsSuccessful = result.IsSuccessful; if (result.IsSuccessful) { // Refresh whole list RetrieveInstances(facade); } else { // Deal with Update result ProcUpdateResult(result.ValidationResult, result.Exception); } } }