コード例 #1
0
        public ActionResult DeleteItem(string T_name, string D_name, string D_id, string BtnSubmit)
        {
            if (BtnSubmit == "确定")
            {
                switch (T_name)
                {
                case "物品":
                    //Commodity表的删除操作
                    CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer();
                    string path = Server.MapPath("/image/");
                    commodityBusinessLayer.DeleteCommodity(D_id, path);
                    return(RedirectToAction("Attributes"));

                case "用户":
                    UserBusinessLayer userBusinessLayer = new UserBusinessLayer();
                    userBusinessLayer.DeleteUser(D_id);
                    return(RedirectToAction("Information"));

                default:
                    return(RedirectToAction("Warehouse"));
                }
            }
            else if (BtnSubmit == "取消")
            {
                return(RedirectToAction("Warehouse"));
            }

            //如果不是按键操作,刷新本页面
            CreateWarehouseViewModel createWarehouseViewModel = new CreateWarehouseViewModel();

            createWarehouseViewModel.warehouse = new Warehouse();
            return(PartialView("CreateWarehouse", createWarehouseViewModel));
        }