public async Task <(ResponseCode code, Job result)> CreateJobAsync(Job job) { var pollyResult = await Policy.ExecuteAndCaptureAsync(async() => await api.CreateJob(job, Constants.ApiManagementKey)); if (pollyResult.Result != null) { return(ResponseCode.Success, pollyResult.Result); } return(ResponseCode.Error, null); }
public async Task <(ResponseCode code, Job result)> CreateJobAsync(Job job) { // Create an instance of the Refit RestService for the job interface. IJobServiceAPI api = RestService.For <IJobServiceAPI>(Constants.BaseUrl); var pollyResult = await Policy.ExecuteAndCaptureAsync(async() => await api.CreateJob(job, Constants.ApiManagementKey)); if (pollyResult.Result != null) { return(ResponseCode.Success, pollyResult.Result); } return(ResponseCode.Error, null); }