Exemplo n.º 1
0
 [HttpPost]//posting to the view
 public ActionResult DeleteProduct(ProductModel products)
 {
     try
     {
         var productMap = AutoMapper.Mapper.Map <ProductModel, Product>(products);
         productDetails.DeleteProduct(productMap);
         return(RedirectToAction("ViewProduct"));
     }
     catch
     {
         return(RedirectToAction("Error", "Error"));
     }
 }
Exemplo n.º 2
0
 // GET: ProductController/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         _productBL.DeleteProduct(_productBL.GetProductById(id));
         Log.Information($"Product deleted-- ID: {id}");
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception e)
     {
         Helper.WriteError(e, "Error");
         Helper.WriteFatal(e, "Fatal");
         Helper.WriteVerbose(e, "Verbose");
         return(View());
     }
 }
Exemplo n.º 3
0
 public void Delete(int id)
 {
     productBL.DeleteProduct(id);
 }