public async Task <AddToFavoritesResponse> AddToFavoritesAsync(AddToFavoritesRequest request, AddToFavoritesResponse response) { try { var newFavorite = await _weatherRepository.AddPlaceToFavorites(request.CityKey).ConfigureAwait(false); if (newFavorite != null) { response.CityKey = newFavorite.PlaceID; response.CityName = newFavorite.PlaceName; response.Success("AddToFavoritesAsync"); } } catch (Exception ex) { response.Failed(ex); } return(response); }
public async Task <AddToFavoritesResponse> AddToFavoritesAsync(AddToFavoritesRequest request, AddToFavoritesResponse response) { try { response = await _weatherDataLayer.AddToFavoritesAsync(request, response).ConfigureAwait(false); if (response.IsSuccess) { response.Success("AddToFavoritesAsync"); } else { response.Failed("WeatherWorkflow:AddToFavoritesAsync"); } } catch (Exception ex) { response.Failed(ex); } return(response); }
public async Task <AddToFavoritesResponse> AddToFavoritesAsync([FromBody] AddToFavoritesRequest request) { var response = new AddToFavoritesResponse(); try { response = await _weatherWorkflow.AddToFavoritesAsync(request, response).ConfigureAwait(false); if (response.IsSuccess) { response.Success("AddToFavoritesAsync"); } else { response.Failed("WeatherController:AddToFavoritesAsync"); } } catch (Exception ex) { response.Failed(ex); } return(response); }