public async Task <IActionResult> UpdateTaskStatusAsync(int taskId, enTaskStatus status, CancellationToken cancellationToken) { if (!ModelState.IsValid) { var errors = ModelState.StringifyModelErrors(); return(BadRequest(errors)); } return(Ok(await _dataRepository.UpdateTaskStatus(taskId, status))); }
public async Task <bool> UpdateTaskStatus(int taskId, enTaskStatus status) { try { var task = GetTask(taskId); if (task != null) { task.Status = status; await _taskContext.SaveChangesAsync(); return(true); } return(false); } catch (Exception ex) { _logger.LogError("UpdateTaskStatus: " + ex.Message); return(false); } }
private async Task <string> UpdateTaskStatus(TaskInfo newTask, enTaskStatus status, string token) { return(await CallTask(string.Format(TaskUrl, "updatetaskstatus?taskid= " + newTask.TaskId + "&status=" + status.ToString()), token, JsonConvert.SerializeObject(newTask), "POST")); }