/// <summary>
        /// 根据文件key删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DeleteResultDto Remove(RemoveParam request)
        {
            new RemoveParamValidator().Validate(request).Check(HttpStatus.Err.Name);
            HttpResult deleteRet = GetBucketManager(request.PersistentOps)
                                   .Delete(Core.Tools.GetBucket(QiNiuConfig, request.PersistentOps.Bucket), request.Key);
            var res = deleteRet.Code == (int)HttpCode.OK;

            return(new DeleteResultDto(res, request.Key, res ? "删除成功" : deleteRet.ToString()));
        }
Beispiel #2
0
        /// <summary>
        /// 根据key删除文件
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DeleteResultDto Remove(RemoveParam request)
        {
            return(ToolCommon.GetResponse(() =>
            {
                new RemoveParamValidator().Validate(request).Check(HttpStatus.Err.Name);
                var zone = Core.Tools.GetZone(_aLiYunConfig, request.PersistentOps.Zone, () => ZoneEnum.HangZhou);
                var client = _aLiYunConfig.GetClient(zone);
                var bucket = Core.Tools.GetBucket(_aLiYunConfig, request.PersistentOps.Bucket);
                var ret = client.DeleteObject(bucket, request.Key);
                if (ret.HttpStatusCode == HttpStatusCode.OK)
                {
                    return new DeleteResultDto(true, request.Key, "success");
                }

                return new DeleteResultDto(false, request.Key,
                                           $"RequestId:{ret.RequestId},HttpStatusCode:{ret.HttpStatusCode}");
            }, message => new DeleteResultDto(false, request.Key, message)));
        }
        public IActionResult Remove([FromBody] RemoveParam param)
        {
            string result = "";

            if (param.Id == Guid.Empty)
            {
                result = "对象不能为空!!!";
            }
            else
            {
                string strsql    = $"delete FROM UserInfo where Id= '{param.Id}'";
                var    dataCount = SQLiteHelper.ExecuteNonQuery(strsql);
                if (dataCount > 0)
                {
                    result = "操作成功!!!";
                }
            }
            return(Json(result));
        }
 /// <summary>
 /// 根据文件key删除
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public DeleteResultDto Remove(RemoveParam request)
 {
     throw new NotImplementedException();
 }