public ActionResult Create()
        {
            ViewBag.Title = "New Inventory Item";

            var vendorList = new List <string>();

            vendorList.Add("");

            try
            {
                foreach (string vendor in _vendorManager.GetActiveVendorNames())
                {
                    vendorList.Add(vendor);
                }
            }
            catch
            {
                //Will simply populate an empty list of Vendors no action needed
            }

            ViewBag.VendorList = vendorList;

            return(View());
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _unassignedVendors = _vendorManager.GetActiveVendorNames();
            lstUnassignedVendors.ItemsSource = _unassignedVendors;
            lstItemVendors.ItemsSource       = _itemVendors;

            noPreferenceText = "No Preference";

            //Populating ComboBox with all active Vendors
            cmbPreferredVendor.Items.Add(noPreferenceText);
            foreach (string vendorName in _vendorManager.GetActiveVendorNames())
            {
                cmbPreferredVendor.Items.Add(vendorName);
            }

            if (_addMode == false) //Viewing Details
            {
                //Set up fields for viewing details
                txtItemName.Text                 = _inventoryItem.ItemName;
                txtPurchaseUnit.Text             = _inventoryItem.PurchaseUnit;
                txtSaleUnit.Text                 = _inventoryItem.SaleUnit;
                txtSaleUnitsPerPurchaseUnit.Text = _inventoryItem.SaleUnitsPerPurchaseUnit.ToString();
                txtQuantityOnHand.Text           = _inventoryItem.QuantityOnHand.ToString();
                txtReorderLevel.Text             = _inventoryItem.ReorderLevel.ToString();
                chkActive.IsChecked              = _inventoryItem.Active;

                //Set current preferred vendor
                string currentPreferredVendor = _vendorManager.RetrievePreferredVendor(_inventoryItem.ItemName);
                if (currentPreferredVendor != "" && currentPreferredVendor != null) //Preferred Vendor found
                {
                    cmbPreferredVendor.SelectedItem = currentPreferredVendor;
                }
                else
                {
                    cmbPreferredVendor.SelectedItem = noPreferenceText;
                }

                //Disable changes and change to gray
                txtItemName.IsReadOnly                 = true;
                txtPurchaseUnit.IsReadOnly             = true;
                txtSaleUnit.IsReadOnly                 = true;
                txtSaleUnitsPerPurchaseUnit.IsReadOnly = true;
                txtQuantityOnHand.IsReadOnly           = true;
                txtReorderLevel.IsReadOnly             = true;
                cmbPreferredVendor.IsEnabled           = false;
                txtItemName.Background                 = Brushes.LightGray;
                txtPurchaseUnit.Background             = Brushes.LightGray;
                txtSaleUnit.Background                 = Brushes.LightGray;
                txtSaleUnitsPerPurchaseUnit.Background = Brushes.LightGray;
                txtQuantityOnHand.Background           = Brushes.LightGray;
                txtReorderLevel.Background             = Brushes.LightGray;
                chkActive.IsEnabled = false;

                _itemVendors = _vendorManager.GetVendorsByInventoryID(_inventoryItem.ItemName);
                lstItemVendors.ItemsSource = _itemVendors; //Won't update display without this line again

                //Removes Item's vendors from UnassignedVendors
                updateUnassignedVendors();
            }
            else //Creating an Inventory Item
            {
                //Set up fields for creating an Inventory Item
                chkActive.IsChecked = true;
                chkActive.IsEnabled = false;
                txtItemName.Focus();
                cmbPreferredVendor.SelectedItem = noPreferenceText;

                showSaveButton();
            }
        }