private void createNewInventoryItem()
        {
            string itemName = null; //Name Needed for setting preferred vendor

            InventoryItem item = getInventoryItemFromInput();

            try
            {
                itemName = _inventoryManager.AddInventoryItem(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message,
                                "Inventory Item Creation Failed", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (itemName == null) //Item not created
            {
                MessageBox.Show("Item Could Not Be Created With Supplied Fields", "Inventory Item Creation Failed",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                this.DialogResult = false;
            }
            else //Item created
            {
                //Sets preferred and selected vendors
                setVendorsToSelected(itemName);

                MessageBox.Show("Inventory Item Successfully Created", "Inventory Item Created",
                                MessageBoxButton.OK, MessageBoxImage.Information);

                this.DialogResult = true;
            }
        }
        public ActionResult Create(FormCollection form)
        {
            InventoryItem inventoryItem = new InventoryItem();

            inventoryItem.ItemName                 = form.Get("ItemName");
            inventoryItem.PurchaseUnit             = form.Get("PurchaseUnit");
            inventoryItem.SaleUnit                 = form.Get("SaleUnit");
            inventoryItem.SaleUnitsPerPurchaseUnit = Convert.ToDecimal(form.Get("SaleUnitsPerPurchaseUnit"));
            inventoryItem.QuantityOnHand           = Convert.ToDecimal(form.Get("QuantityOnHand"));
            inventoryItem.ReorderLevel             = Convert.ToDecimal(form.Get("ReorderLevel"));

            try
            {
                _inventoryManager.AddInventoryItem(inventoryItem);

                _vendorManager.SetPreferredVendor(inventoryItem.ItemName, form.Get("PreferredVendor"));

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }