コード例 #1
0
        /*Much like the Customer Update Form option this takes an item name from a drop down and creates a propogated
         * form that can be edited. THIS WILL UPDATE WHATEVER ITEMS ARE CHANGED.
         * */
        public PartialViewResult itemUpdateForm(FormCollection frm)
        {
            NewInventoryViewModel ivm = new NewInventoryViewModel();
            DataSet ItemInfo = new DataSet();
            string itemName = Request.Form["lstItemName"];

            ItemInfo = ac.findItemInfo(itemName);
            foreach (DataTable item in ItemInfo.Tables)
            {
                foreach (DataRow row in item.Rows)
                {
                    ivm.lstItem.Add(new FindItemInfo()
                    {
                        Price = Convert.ToDecimal(row["Price"]),
                        Quantity = Convert.ToInt32(row["Quantity"]),
                        Name = Convert.ToString(row["itemName"]),
                        ProductID = Convert.ToInt32(row["ID"])
                    });
                }
            }
            return PartialView("_updateItem", ivm);
        }
コード例 #2
0
        /*This creates a simple view of what is in the inventory database. There is also a button created in the last
         * column of the table to easily remove an item from the database.
         * */
        public ActionResult InventoryView()
        {
            NewInventoryViewModel ivm = new NewInventoryViewModel();
            DataSet ItemInfo = new DataSet();
            ItemInfo = ac.getItemInfo();
            foreach (DataTable item in ItemInfo.Tables)
            {

                foreach (DataRow row in item.Rows)
                {
                    ivm.name.Add(Convert.ToString(row["itemName"]));
                    ivm.price.Add(Convert.ToDecimal(row["Price"]));
                    ivm.quantity.Add(Convert.ToInt32(row["Quantity"]));
                    ivm.id.Add(Convert.ToInt32(row["ID"]));

                }
            }
            return View(ivm);
        }