public async Task <ResponseEntity> updateEstimate(updateEstimate model, string token) { var task = _taskRepository.GetSingleByConditionAsync("taskId", model.taskId).Result; if (task == null) { return(new ResponseEntity(StatusCodeConstants.NOT_FOUND, "task is not found!", MessageConstants.MESSAGE_ERROR_404)); } UserJira user = _userService.getUserByToken(token).Result; List <KeyValuePair <string, dynamic> > columns = new List <KeyValuePair <string, dynamic> >(); columns.Add(new KeyValuePair <string, dynamic>("taskId", task.taskId)); columns.Add(new KeyValuePair <string, dynamic>("userId", user.id)); var projectUser = _taskUserRepository.GetMultiByListConditionAndAsync(columns).Result; if (projectUser.Count() == 0) { return(new ResponseEntity(StatusCodeConstants.NOT_FOUND, "user is not assign!", MessageConstants.MESSAGE_ERROR_404)); } task.originalEstimate = model.originalEstimate; await _taskRepository.UpdateAsync("taskId", task.taskId, task); return(new ResponseEntity(StatusCodeConstants.OK, "Update task successfully!", MessageConstants.UPDATE_SUCCESS)); }
public async Task <IActionResult> updateEstimate(updateEstimate model) { var accessToken = Request.Headers[HeaderNames.Authorization]; return(await _projectService.updateEstimate(model, accessToken)); }