Пример #1
0
 public Product DeleteProduct(int productId)
 {
     try
     {
         Product dbProduct = _efDatabaseContext.FindProduct(productId);
         if (dbProduct == null)
         {
             throw new KeyNotFoundException();
         }
         else
         {
             _efDatabaseContext.DeleteProduct(dbProduct);
             _efDatabaseContext.SaveProductChanges();
         }
         return(dbProduct);
     }
     catch
     {
         throw;
     }
 }