public ActionResult Delete(int productId, string type, string name) { IComponents deletedProduct = null; switch (type) { case "Products": deletedProduct = productRepository.DeleteProduct(productId); break; case "Categories": deletedProduct = productRepository.DeleteCategory(name); break; case "Characteristics": deletedProduct = productRepository.DeleteCharacteristic(productId); break; case "CharValues": productRepository.DeleteCharValue(productId); break; case "Cities": productRepository.DelteCity(productId); break; } if (deletedProduct != null) { TempData["message"] = $"\"{deletedProduct.Name}\" был удален"; } return(RedirectToAction("Index")); }
private void btnDeleteProduct_Click(object sender, EventArgs e) { efProductRepository.DeleteProduct(idProduct); dataGridViewProduct.DataSource = efProductRepository.GetActiveProduct(); efProductRepository.TextBoxEraser(grpDeleteProduct); }