public async Task <IActionResult> Get(Guid portfolioId) { _logger.LogInformation("Getting all items"); try { var portfolios = await _portfoliosService.GetPortfolio(portfolioId); return(Ok(_mapper.Map <ICollection <Item> >(portfolios.Items))); } catch (Exception ex) { _logger.LogError($"{_localizer["Failed to get all items"]}", ex); return(BadRequest()); } }
public async Task <IActionResult> Get(Guid userId) { _logger.LogInformation($"Getting portfolio for user {userId}"); try { var watchlist = await _portfoliosService.GetPortfolio(userId); return(Ok(watchlist)); } catch (Exception ex) { _logger.LogError($"Failed to get portfolio for user {userId}" + ex); return(BadRequest()); } }
public async Task <IActionResult> Get(Guid id) { _logger.LogInformation($"Getting portfolio by Id = {id}"); try { var portfolio = await _portfoliosService.GetPortfolio(id); if (portfolio != null) { return(Ok(_mapper.Map <Portfolio>(portfolio))); } else { return(NotFound()); } } catch (Exception ex) { _logger.LogError($"Failed to get portfolio with Id = {id}", ex); return(BadRequest()); } }