Exemple #1
0
        public bool DeleteProduct(int id) // ProductTable Methods
        {
            try
            {
                var deleteproduct = (from allproducts in ProductTable
                                     where allproducts.Pid == id
                                     select allproducts).First();

                if (deleteproduct != null)
                {
                    ProductTable.Remove(deleteproduct);
                    SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }
        }