public IActionResult UpdateTaskStatus([FromBody] StatusUpdate requestParam) { try { var task = _taskRepository.Get(requestParam.taskId); var subTask = _subTaskRepository.GetAll(requestParam.taskId); if (subTask.Count() == 0 && task != null) { task.State = requestParam.status; _taskRepository.Save(); return(StatusCode(StatusCodes.Status202Accepted)); } else { if (task == null) { _logger.LogWarning($"There is no task with ID {requestParam.taskId}"); } else { _logger.LogWarning($"There are no Subtasks Under The Task ID {requestParam.taskId}"); } return(StatusCode(StatusCodes.Status304NotModified)); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }
public IEnumerable <SubTask> GetAll() { return(_subTaskRepository.GetAll()); }