public IActionResult UpdateUserTargets(int id, [FromBody] UserTargets targets) { targets.UserId = id; UpdateUserTargetsResponse response = _userService.UpdateUserTargets(targets); if (!response.ResponseStatus.HasError()) { return(Ok()); } return(StatusCode(response.ResponseStatus.Status, response.ResponseStatus.Message)); }
public UpdateUserTargetsResponse UpdateUserTargets(UserTargets targets) { UpdateUserTargetsResponse response = new UpdateUserTargetsResponse(); //TODO: Handle with non existent user id try { _userRepository.UpdateUserTargets(targets); response.ResponseStatus.SetOk(); } catch (Exception e) { _logger.LogError(e.ToString()); response.ResponseStatus.SetError(ResponseStatusCode.INTERNAL_SERVER_ERROR, e.ToString()); } return(response); }