Beispiel #1
0
 public ActionResult DeleteProduct(string productId)
 {
     try
     {
         using (ESamhashoEntities entities = new ESamhashoEntities())
         {
             if (!long.TryParse(productId, out long id))
             {
                 return new ActionResult {
                            Message = "Deleted failed"
                 }
             }
             ;
             entities.DeleteProduct(id);
             return(new ActionResult {
                 Message = "Deleted successfully", Success = true
             });
         }
     }
     catch (Exception exception)
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>
         {
             { "productId", productId }
         };
         ServiceHelper.LogException(exception, dictionary, ErrorSource.Product);
         return(new ActionResult {
             Message = "Error, failed to delete product, try again."
         });
     }
 }