public static void UpdateReviewInDB(string sRestName, string sAddress,
                                            decimal dRating, string sSummary)
        {
            Review localReview;

            try
            {
                using (var db = new RestaurantReviewP0Entities())
                {
                    localReview = db.Reviews.Single(x => x.rName == sRestName);

                    localReview.rRating  = dRating;
                    localReview.rSummary = sSummary;

                    db.Reviews.Attach(localReview);
                    db.Entry(localReview).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (DbUpdateException se)
            {
                Debug.WriteLine("Exception handled:\n" + se.Message);
                Debug.WriteLine("Stack Trace:\n" + se.StackTrace);
                Debug.WriteLine(se.InnerException.Message);
                Debug.WriteLine(se.InnerException);
            }
            catch (SqlException se)
            {
                Console.WriteLine("Exception handled:\n" + se.Message);
                Console.WriteLine("Stack Trace:\n" + se.StackTrace);
            }
            catch (DbException de)
            {
                Console.WriteLine("Exception handled:\n" + de.Message);
                Console.WriteLine("Stack Trace:\n" + de.StackTrace);
            }
            catch (ExternalException ee)
            {
                Console.WriteLine("Exception handled:\n" + ee.Message);
                Console.WriteLine("Stack Trace:\n" + ee.StackTrace);
            }
            catch (SystemException syse)
            {
                Console.WriteLine("Exception handled:\n" + syse.Message);
                Console.WriteLine("Stack Trace:\n" + syse.StackTrace);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception handled:\n" + e.Message);
                Console.WriteLine("Stack Trace:\n" + e.StackTrace);
            }
        }
        // method to update record into database
        public static void UpdateRestaurantInDB(string sRestName, string sAddress)
        {
            Restaurant localRestaurant;
            RestaurantReviewP0Entities db;

            try
            {
                using (db = new RestaurantReviewP0Entities())
                {
                    localRestaurant = db.Restaurants.Single(x => x.rName == sRestName);

                    localRestaurant.rName    = sRestName;
                    localRestaurant.rAddress = sAddress;

                    db.Restaurants.Attach(localRestaurant);
                    db.Entry(localRestaurant).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (DbUpdateException se)
            {
                Debug.WriteLine("Exception handled:\n" + se.Message);
                Debug.WriteLine("Stack Trace:\n" + se.StackTrace);
                Debug.WriteLine(se.InnerException.Message);
                Debug.WriteLine(se.InnerException);
            }
            catch (SqlException se)
            {
                Debug.WriteLine("Exception handled:\n" + se.Message);
                Debug.WriteLine("Stack Trace:\n" + se.StackTrace);
            }
            catch (DbException de)
            {
                Debug.WriteLine("Exception handled:\n" + de.Message);
                Debug.WriteLine("Stack Trace:\n" + de.StackTrace);
            }
            catch (ExternalException ee)
            {
                Console.WriteLine("Exception handled:\n" + ee.Message);
                Console.WriteLine("Stack Trace:\n" + ee.StackTrace);
            }
            catch (SystemException syse)
            {
                Console.WriteLine("Exception handled:\n" + syse.Message);
                Console.WriteLine("Stack Trace:\n" + syse.StackTrace);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Exception handled:\n" + e.Message);
                Debug.WriteLine("Stack Trace:\n" + e.StackTrace);
            }
        }
        public static void DeleteReviewFromDB(string sRestName, decimal dRating, string sSummary)
        {
            RestaurantReviewP0Entities db;
            var lsReviews = ShowAllReviews();

            try
            {
                using (db = new RestaurantReviewP0Entities())
                {
                    var query = (from r in lsReviews
                                 where r.rName == sRestName && r.rRating == dRating && r.rSummary == sSummary
                                 select r);

                    db.Reviews.Attach((Review)query);
                    db.Entry(query).State = EntityState.Deleted;
                    db.Reviews.Remove((Review)query);
                    db.SaveChanges();
                }
            }
            catch (SqlException se)
            {
                Console.WriteLine("Exception handled:\n" + se.Message);
                Console.WriteLine("Stack Trace:\n" + se.StackTrace);
            }
            catch (DbException de)
            {
                Console.WriteLine("Exception handled:\n" + de.Message);
                Console.WriteLine("Stack Trace:\n" + de.StackTrace);
            }
            catch (ExternalException ee)
            {
                Console.WriteLine("Exception handled:\n" + ee.Message);
                Console.WriteLine("Stack Trace:\n" + ee.StackTrace);
            }
            catch (SystemException syse)
            {
                Console.WriteLine("Exception handled:\n" + syse.Message);
                Console.WriteLine("Stack Trace:\n" + syse.StackTrace);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception handled:\n" + e.Message);
                Console.WriteLine("Stack Trace:\n" + e.StackTrace);
            }
        }