Esempio n. 1
0
        public ActionResult Delete(int id)
        {
            try
            {
                ShopsBLL spBll = new ShopsBLL(); UsersBLL uBll = new UsersBLL();

                Shops shop = spBll.Find(id);
                Users user = uBll.SelectWhere(m => m.S_ID == shop.S_ID && m.U_Role == 2).FirstOrDefault();
                using (TransactionScope ts = new TransactionScope())
                {
                    // 软删除当前店铺的管理员
                    if (user != null)
                    {
                        user.U_Role = 4;
                        uBll.SaveChanges();
                    }
                    shop.S_Category = 4;
                    spBll.SaveChanges();
                    ts.Complete();
                }
                return Json(new { result = "ok" });
            }
            catch
            {
                return Json(new { result = "error" });
            }
        }