/// <summary>
        /// Adds A Product
        /// Level: Logic
        /// </summary>
        /// <param name="Name">Product Name</param>
        /// <param name="Status">Product Status</param>
        /// <param name="Description">Product Description</param>
        /// <param name="ImageURL">Product ImageURL</param>
        /// <param name="CategoryFK">The Category ID</param>
        /// <param name="VatRate">The VatRate</param>
        /// <param name="SupplierFK">The Supplier FK</param>
        /// <param name="ReorderLevel">The Reorder Level</param>
        public void AddProduct(string Name, bool Status, string Description, string ImageURL, int CategoryFK, 
            double VatRate, int SupplierFK, int ReorderLevel)
        {
            try
            {
                ProductsRepository myRepository = new ProductsRepository();

                Product myProduct = new Product();

                myProduct.Id = Guid.NewGuid();
                myProduct.Name = Name;
                myProduct.Description = Description;
                myProduct.StockQuantity = 0;
                myProduct.Status = Status;
                myProduct.ImageURL = ImageURL;
                myProduct.CategoryFK = CategoryFK;
                myProduct.SupplierFK = SupplierFK;
                myProduct.ReorderLevel = ReorderLevel;

                Vatrate myVatRate = myRepository.RetrieveVatRate(VatRate);

                if (myVatRate != null)
                {
                    myProduct.Vatrate = myVatRate;
                }
                else
                {
                    myVatRate = new Vatrate();
                    myVatRate.Vatrate1 = VatRate;
                    myProduct.Vatrate = myVatRate;
                }

                myRepository.AddProduct(myProduct);
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Vatrates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVatrates(Vatrate vatrate)
 {
     base.AddObject("Vatrates", vatrate);
 }
        /// <summary>
        /// Updates a Product
        /// Level: Data
        /// </summary>
        /// <param name="myProduct">A Products view representing the product</param>
        public void UpdateProduct(ProductsView myProduct)
        {
            try
            {
                Product myOriginalProduct = RetrieveProductByID(myProduct.Id);

                myOriginalProduct.Name = myProduct.Name;
                myOriginalProduct.Description = myProduct.Description;

                if (myProduct.ImageURL != null)
                {
                    myOriginalProduct.ImageURL = myProduct.ImageURL;
                }

                myOriginalProduct.Status = myProduct.Status;
                myOriginalProduct.CategoryFK = myProduct.CategoryFK;
                myOriginalProduct.SupplierFK = myProduct.SupplierFK;
                myOriginalProduct.ReorderLevel = myProduct.ReorderLevel;

                Vatrate myVatRate = RetrieveVatRate(myProduct.VatRate);

                if (myVatRate != null)
                {
                    myOriginalProduct.Vatrate = myVatRate;
                }
                else
                {
                    myVatRate = new Vatrate();
                    myVatRate.Vatrate1 = myProduct.VatRate;
                    myOriginalProduct.Vatrate = myVatRate;
                }

                Entities.SaveChanges();
            }
            catch (Exception Exception)
            {
                throw Exception;
            }
        }
 /// <summary>
 /// Create a new Vatrate object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="vatrate1">Initial value of the Vatrate1 property.</param>
 public static Vatrate CreateVatrate(global::System.Int32 id, global::System.Double vatrate1)
 {
     Vatrate vatrate = new Vatrate();
     vatrate.Id = id;
     vatrate.Vatrate1 = vatrate1;
     return vatrate;
 }