示例#1
0
        public ActionResult EditOrder(int ID)
        {
            var purchaseOrder = iOrder.GetOrderList().Where(x => x.ID == ID).FirstOrDefault();
            var purchaseItems = iOrder.GetPurchaseItems(purchaseOrder.ID);

            purchaseOrder.PurchaseItems = purchaseItems;

            var IDs  = purchaseOrder.PurchaseItems.Select(x => x.SKUID).ToArray();
            var SKUs = iSKUs.GetSKUsList().Where(x => !IDs.Contains(x.ID) && x.IsActive == true).ToList();

            List <SelectListItem> ddlItem = new List <SelectListItem>();

            ddlItem.Add(new SelectListItem
            {
                Value = "",
                Text  = "- Please Select -"
            });
            foreach (var item in SKUs)
            {
                ddlItem.Add(new SelectListItem
                {
                    Value = item.ID.ToString(),
                    Text  = item.Name
                });
            }
            ViewBag.ddlItem = ddlItem;

            return(View(purchaseOrder));
        }