public async Task <IActionResult> Get(Guid watchlistId) { _logger.LogInformation("Getting all items"); try { var watchlists = await _watchlistsService.GetWatchlist(watchlistId); return(Ok(_mapper.Map <ICollection <Item> >(watchlists.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 watchlist for user {userId}"); try { var watchlist = await _watchlistsService.GetWatchlist(userId); return(Ok(watchlist)); } catch (Exception ex) { _logger.LogError($"Failed to get watchlist for user {userId}" + ex); return(BadRequest()); } }
public async Task <IActionResult> Get(Guid id) { _logger.LogInformation($"Getting watchlist by Id = {id}"); try { var watchlist = await _watchlistsService.GetWatchlist(id); if (watchlist != null) { return(Ok(_mapper.Map <Watchlist>(watchlist))); } else { return(NotFound()); } } catch (Exception ex) { _logger.LogError($"Failed to get watchlist with Id = {id}", ex); return(BadRequest()); } }