public async Task <PipelineResult> Manage(RecievedOrder order) { _logger.AddMessageDetail("Beginning order processing"); var pipelineData = _orderDataConverter.Convert(order); var pipelineResult = new PipelineResult(); try { await _pipelineDirector.Do(pipelineData, pipelineResult); } catch (Exception ex) { AssignException(pipelineResult, ex); _logger.AddErrorDetail(ex.Message); _logger.SubmitException(ex); await HandlePipelineException(pipelineData, pipelineResult); } return(pipelineResult); }
public IEnumerable <IPipeline <PipelineData, PipelineResult> > GetOrderedPipelines() { try { var fulfilmentPipelines = _serviceProvider.GetServices <IPipeline <PipelineData, PipelineResult> >(); var fulfilmentPipelineNames = PipelineSequenceHelper.FulfilmentPipelines.Select(x => x.GetValue <string>("Name")); return(fulfilmentPipelines .Where(x => fulfilmentPipelineNames.Contains(x.Name)) .SortBy(fulfilmentPipelineNames, x => x.Name)); } catch (Exception ex) { _logger.AddErrorDetail(ex.Message); _logger.SubmitException(ex); throw; } }
public async Task <ActionResponse <UserTVShowMapping> > Delete(string userId, string showKey) { try { if (showKey == null) { throw new Exception("Unable to show"); } _logger.AddMessageDetail($"DeleteUserTvShowMapping: Attempting to delete show mapping with Show Key: {showKey} and userid: {userId}"); await _commandActionHandlers.DeleteUserTvShowMappingAsync(userId, showKey); _logger.AddMessageDetail($"DeleteUserTvShowMapping: Successfully deleted show with key: {showKey} and userid: {userId}"); return(GenerateResponse()); } catch (Exception ex) { _logger.AddErrorDetail($"DeleteUserTvShowMapping: Error, could not add show mapping, error was - {ex.Message}"); _logger.SubmitException(ex); return(GenerateResponse(ex.Message)); } }
public async Task <ActionResponse <UserTVShowMapping> > Add(UserTVShowMapping tvShowMapping) { try { if (tvShowMapping.UserId == null) { throw new Exception("Unable to find user"); } _logger.AddMessageDetail($"AddUserTVShowMapping: Attempting to add show mapping with Show Name: {tvShowMapping.TvShow.ShowName} and userid: {tvShowMapping.UserId}"); await _commandActionHandlers.AddUserTVShowMappingAsync(tvShowMapping); _logger.AddMessageDetail($"AddUserTVShowMapping: Successfully added show with Name: {tvShowMapping.TvShow.ShowName} and userid: {tvShowMapping.UserId}"); return(GenerateResponse(tvShowMapping)); } catch (Exception ex) { _logger.AddErrorDetail($"AddUserTVShowMapping: Error, could not add show mapping, error was - {ex.Message}"); _logger.SubmitException(ex); return(GenerateResponse(tvShowMapping, ex.Message)); } }
public async Task <ActionResponse <IEnumerable <TvShow> > > GetTvShowsByUserId(string userId) { try { if (userId == null) { throw new Exception("Unable to obtain user"); } _logger.AddMessageDetail($"GetTVShowsByUser: Getting shows for user with Id: {userId}"); var shows = await _queryActionHandlers.GetTVShowMappingsByUserId(userId); _logger.AddMessageDetail($"GetTVShowsByUser: Retrieved {shows.Count()} shows for user with Id: {userId}"); var response = GenerateResponse(shows.Select(x => x.TvShow)); return(response); } catch (Exception ex) { _logger.AddErrorDetail($"GetTVShowsByUser: Failed to retrieve shows, reason was: {ex.Message}"); _logger.SubmitException(ex); var response = GenerateResponse(null, ex.Message); return(response); } }