コード例 #1
0
        public IActionResult Delete(int id)
        {
            DeleteDeviceResponse response = new DeleteDeviceResponse();

            var device = GetDevice(id);

            if (device == null)
            {
                return(NotFound(response));
            }

            var isDeleted = uow.Device.Delete(device);

            if (!isDeleted.Success)
            {
                return(NotFound(response, isDeleted.Message));
            }

            if (!uow.Commit())
            {
                return(NotFound(response));
            }

            response.IsDeleted = isDeleted.Success;

            return(Ok(response));
        }
コード例 #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteDeviceResponse response = new DeleteDeviceResponse();


            return(response);
        }
        public static DeleteDeviceResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteDeviceResponse deleteDeviceResponse = new DeleteDeviceResponse();

            deleteDeviceResponse.HttpResponse = context.HttpResponse;
            deleteDeviceResponse.RequestId    = context.StringValue("DeleteDevice.RequestId");

            return(deleteDeviceResponse);
        }
コード例 #4
0
        public static DeleteDeviceResponse Unmarshall(UnmarshallerContext context)
        {
            DeleteDeviceResponse deleteDeviceResponse = new DeleteDeviceResponse();

            deleteDeviceResponse.HttpResponse = context.HttpResponse;
            deleteDeviceResponse.RequestId    = context.StringValue("DeleteDevice.RequestId");
            deleteDeviceResponse.Success      = context.BooleanValue("DeleteDevice.Success");
            deleteDeviceResponse.ErrorMessage = context.StringValue("DeleteDevice.ErrorMessage");

            return(deleteDeviceResponse);
        }
        public static DeleteDeviceResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DeleteDeviceResponse deleteDeviceResponse = new DeleteDeviceResponse();

            deleteDeviceResponse.HttpResponse = _ctx.HttpResponse;
            deleteDeviceResponse.ErrorCode    = _ctx.IntegerValue("DeleteDevice.ErrorCode");
            deleteDeviceResponse.Message      = _ctx.StringValue("DeleteDevice.Message");
            deleteDeviceResponse.Success      = _ctx.BooleanValue("DeleteDevice.Success");
            deleteDeviceResponse.RequestId    = _ctx.StringValue("DeleteDevice.RequestId");

            return(deleteDeviceResponse);
        }
コード例 #6
0
        /// <summary>
        /// 删除设备
        /// </summary>
        public DeleteDeviceResponse DeleteDevice(DeleteDeviceRequest deleteDeviceRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("device_id", deleteDeviceRequest.DeviceId.ToString());
            string               urlPath              = HttpUtils.AddUrlPath("/v5/iot/{project_id}/devices/{device_id}", urlParam);
            SdkRequest           request              = HttpUtils.InitSdkRequest(urlPath, deleteDeviceRequest);
            HttpResponseMessage  response             = DoHttpRequestSync("DELETE", request);
            DeleteDeviceResponse deleteDeviceResponse = JsonUtils.DeSerializeNull <DeleteDeviceResponse>(response);

            return(deleteDeviceResponse);
        }
コード例 #7
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DeleteDeviceResponse response = new DeleteDeviceResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Device", targetDepth))
                {
                    var unmarshaller = DeviceUnmarshaller.Instance;
                    response.Device = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }