示例#1
0
        public async Task <ActionResult> Create([Bind(Include = "id,warrantyID,itemID,startdate,duration,description,MaChinh,Special")] tb_warranty tb_warranty)
        {
            if (ModelState.IsValid)
            {
                db.tb_warranty.Add(tb_warranty);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.itemID = new SelectList(db.items, "id", "productID", tb_warranty.itemID);
            return(View(tb_warranty));
        }
示例#2
0
        public async Task <ActionResult> Create([Bind(Include = "id,productID,productDetailID,inventoryID,customerID,DateOfSold,orderID,CustomerType,warrantyAvailable,tempname,Verified")] item item)
        {
            if (ModelState.IsValid)
            {
                db.items.Add(item);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerType    = new SelectList(db.CustomerTypes, "id", "GroupName", item.CustomerType);
            ViewBag.orderID         = new SelectList(db.orders, "id", "MaBill", item.orderID);
            ViewBag.customerID      = new SelectList(db.tb_customer, "id", "customerName", item.customerID);
            ViewBag.inventoryID     = new SelectList(db.tb_inventory_name, "id", "InventoryName", item.inventoryID);
            ViewBag.productDetailID = new SelectList(db.tb_product_detail, "id", "producFactoryID", item.productDetailID);
            return(View(item));
        }