public ActionResult <ScenarioDto> ByUserId(string userId) { if (String.IsNullOrEmpty(userId)) { return(new BadRequestObjectResult ( new Error { ErrorCode = "Invaliad UserId", ErrorDescription = "Invalid UserId" } )); } var scenarioEntity = _scenarioService.GetScenarioByUserId(userId); if (scenarioEntity == null) { throw new NotFoundException($"Scenario was not found for userId {userId}"); } var scenarioDto = _mapper.Map <ScenarioDto>(scenarioEntity); return(Ok(scenarioDto)); }