Ejemplo n.º 1
0
        public async Task <DeleteFavoriteResponse> DeleteFavoriteAsync(DeleteFavoriteRequest request, DeleteFavoriteResponse response)
        {
            try
            {
                // Map request
                var serviceRequest = _mapper.Map <Repository.Entities.Requests.DeleteFavoriteRequest>(request);

                // Map response
                var serviceResponse = _mapper.Map <Repository.Entities.Responses.DeleteFavoriteResponse>(response);

                // Call action
                serviceResponse = await _weatherWorkflow.DeleteFavoriteAsync(serviceRequest, serviceResponse);

                // Merge response logs
                response.Marge(serviceResponse);

                // Handle response
                if (!response.IsSuccess)
                {
                    response.Failed("WeatherConnector:DeleteFavoriteAsync");
                }
            }
            catch (Exception ex)
            {
                response.Failed(ex);
            }
            return(response);
        }
        public async Task <DeleteFavoriteResponse> DeleteFavoriteAsync(DeleteFavoriteRequest request, DeleteFavoriteResponse response)
        {
            try
            {
                response = await _weatherDataLayer.DeleteFavoriteAsync(request, response).ConfigureAwait(false);

                if (!response.IsSuccess)
                {
                    response.Failed("WeatherWorkflow:DeleteFavoriteAsync");
                }
            }
            catch (Exception ex) { response.Failed(ex); }
            return(response);
        }
Ejemplo n.º 3
0
        public async Task <DeleteFavoriteResponse> DeleteFavoriteAsync([FromBody] DeleteFavoriteRequest request)
        {
            var response = new DeleteFavoriteResponse();

            try
            {
                response = await _weatherWorkflow.DeleteFavoriteAsync(request, response).ConfigureAwait(false);

                if (response.IsSuccess)
                {
                    response.Success("DeleteFavoriteAsync");
                }
                else
                {
                    response.Failed("WeatherController:DeleteFavoriteAsync");
                }
            }
            catch (Exception ex)
            {
                response.Failed(ex);
            }
            return(response);
        }
Ejemplo n.º 4
0
        public async Task <DeleteFavoriteResponse> DeleteFavoriteAsync(DeleteFavoriteRequest request, DeleteFavoriteResponse response)
        {
            try
            {
                var isSuccess = await _weatherRepository.DeleteFromFavorites(request.CityKey).ConfigureAwait(false);

                if (isSuccess)
                {
                    response.Success("DeleteFavoriteAsync");
                }
            }
            catch (Exception ex) { response.Failed(ex); }
            return(response);
        }