protected void Submit_Click(object sender, EventArgs e)
        {
            ProductSupplierVMModel vmModel = new ProductSupplierVMModel();

            vmModel.SupplierID = Convert.ToInt32(SupplierID.Text);
            vmModel.ProductID  = Convert.ToInt32(ProductID.Text);
            if (HiddenField1.Value != "")
            {
                vmModel.ID = Convert.ToInt32(HiddenField1.Value);
            }
            vmModel = iProductSupplierRepository.AddAndUpdateProductSupplier(vmModel);
            if (vmModel.ID > 0)
            {
                Response.Write("<script>alert('Record saved successfully')</script>");
                Response.Redirect("ProductSupplier.aspx");
            }
            bindGrid();
        }
        public ProductSupplierVMModel AddAndUpdateProductSupplier(ProductSupplierVMModel vmModel)
        {
            if (vmModel.ID > 0)
            {
                var record = _db.ProductSuppliers.Where(x => x.ID == vmModel.ID).FirstOrDefault();
                record.ProductID  = vmModel.ProductID;
                record.SupplierID = vmModel.SupplierID;

                _db.SaveChanges();
            }
            else
            {
                ProductSupplier _supplier = new ProductSupplier();
                _supplier.ProductID  = vmModel.ProductID;
                _supplier.SupplierID = vmModel.SupplierID;
                _db.ProductSuppliers.Add(_supplier);
                _db.SaveChanges();
                vmModel.ID = _supplier.ID;
            }
            return(vmModel);
        }