Ejemplo n.º 1
0
        public async Task <bool> DeleteAsync(long id)
        {
            IDictionary <string, string> pairs = new Dictionary <string, string>();

            pairs[nameof(id)] = id.ToString();
            SDKResult result = await client.DeleteAsync("Delete", pairs);

            JObject obj = JsonConvert.DeserializeObject <JObject>(result.Result);

            if (result.StatusCode == System.Net.HttpStatusCode.BadRequest)
            {
                ErrorMsg = obj["errorMsg"].ToString();
                return(false);
            }
            else if (result.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(true);
            }
            else
            {
                throw new ApplicationException("未知的错误");
            }
        }