public async Task <HeartbeatResponseApiModel> SendHeartbeatAsync( [FromBody] HeartbeatApiModel heartbeat) { if (heartbeat == null) { throw new ArgumentNullException(nameof(heartbeat)); } var result = await _orchestrator.SendHeartbeatAsync( heartbeat.ToServiceModel()); return(result.ToApiModel()); }
/// <summary> /// Convert to service model /// </summary> /// <param name="model"></param> /// <returns></returns> public static HeartbeatModel ToServiceModel( this HeartbeatApiModel model) { if (model == null) { return(null); } return(new HeartbeatModel { Worker = model.Worker?.ToServiceModel(), Job = model.Job?.ToServiceModel() }); }