/// <summary> /// Updates the job entity status. /// </summary> /// <param name="jobId">The job identifier.</param> /// <param name="status">The status.</param> /// <param name="message">The message.</param> /// <param name="imageResult">The url string for the converted/failed image.</param> public async Task UpdateJobEntityStatus(string jobId, int status, string message, string imageResult) { JobEntity jobEntityToReplace = await RetrieveJobEntity(jobId); if (jobEntityToReplace != null) { jobEntityToReplace.status = status; jobEntityToReplace.statusDescription = message; await UpdateJobEntity(jobEntityToReplace); } }
/// <summary> /// Updates the job entity. /// </summary> /// <param name="jobEntity">The job entity.</param> public async Task <bool> UpdateJobEntity(JobEntity jobEntity) { TableOperation replaceOperation = TableOperation.Replace(jobEntity); TableResult result = await _table.ExecuteAsync(replaceOperation); if (result.HttpStatusCode > 199 && result.HttpStatusCode < 300) { return(true); } return(false); }
/// <summary> /// Inserts the or replace job entity. /// </summary> /// <param name="jobId">The job identifier.</param> /// <param name="status">The status.</param> /// <param name="message">The message.</param> /// <param name="imageSource">The url string for the uploaded image.</param> /// <param name="imageConversionMode">The type of conversion to be processed.</param> public async Task InsertOrReplaceJobEntity(string jobId, int status, string message, string imageSource, int imageConversionMode) { // Map parameters to JobEntity attributes JobEntity jobEntityToInsertOrReplace = new JobEntity(); jobEntityToInsertOrReplace.RowKey = jobId; jobEntityToInsertOrReplace.imageConversionMode = imageConversionMode; jobEntityToInsertOrReplace.status = status; jobEntityToInsertOrReplace.statusDescription = message; jobEntityToInsertOrReplace.imageSource = imageSource; jobEntityToInsertOrReplace.PartitionKey = _partitionKey; TableOperation insertReplaceOperation = TableOperation.InsertOrReplace(jobEntityToInsertOrReplace); TableResult result = await _table.ExecuteAsync(insertReplaceOperation); }