Beispiel #1
0
        public JsonResult DeleteById(string ids)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(ids))
                {
                    return(Json(new { data = 0, msg = "未能获取数据" }));
                }

                var operLogManager = new Business.OprLogManagement.OprLogManager();
                var result         = 0;
                foreach (var strId in ids.Split(','))
                {
                    if (string.IsNullOrWhiteSpace(strId))
                    {
                        continue;
                    }
                    var id = int.Parse(strId);
                    result += DALUserPermission.Delete(id);
                    var oprLog = new Tuhu.Provisioning.DataAccess.Entity.OprLog
                    {
                        ObjectID   = id,
                        ObjectType = "UserPermission",
                        Author     = HttpContext.User.Identity.Name,
                        Operation  = "删除UserPermission配置"
                    };
                    operLogManager.AddOprLogAsync(oprLog);
                }
                return(Json(new { data = result, msg = "删除成功" }));
            }
            catch (Exception e)
            {
                return(Json(new { data = -1, msg = "删除异常:" + e.ToString() }));
            }
        }
 public static int Delete(string id)
 {
     if (string.IsNullOrEmpty(id))
     {
         return(0);
     }
     return(DALUserPermission.Delete(id));
 }