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)); }
/// <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); }
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); }
/// <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); }
/// <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); }