public DataFixer( ITflService tflService, ILog logger) { Log = logger; TflService = tflService; }
/// <summary> /// Maps the user's preferences onto the specified view model as an asynchronous operation. /// </summary> /// <param name="model">The view model to map.</param> /// <param name="cancellationToken">The cancellation token to use.</param> /// <returns> /// A <see cref="Task"/> representing the asynchronous operation to map the view model. /// </returns> private async Task MapPreferencesAsync(LinePreferencesViewModel model, CancellationToken cancellationToken) { var user = await _userManager.GetUserAsync(User); if (user == null) { _logger?.LogError($"Failed to get user to render preferences."); return; } model.ETag = user.ETag; model.IsAuthenticated = true; model.IsLinkedToAlexa = !string.IsNullOrWhiteSpace(user.AlexaToken); ITflService service = _tflFactory.CreateService(); ICollection <LineInfo> lines = await service.GetLinesAsync(cancellationToken); MapFavoriteLines(model, lines, user.FavoriteLines); string updateResult = HttpContext.Request.Query["UpdateSuccess"].FirstOrDefault(); if (!string.IsNullOrEmpty(updateResult)) { model.UpdateResult = string.Equals(updateResult, bool.TrueString, StringComparison.OrdinalIgnoreCase); } }
public ArticleExaminer( ITflService tflService, ILog logger) { Log = logger; TflService = tflService; BulkArticles = new List <NewsArticleCommand>(); BulkEvents = new List <ExaminationEvent>(); Positions = new[] { "FB/TE", "WR/KR", "LCB", "RCB", "OLB", "MLB", "G/T", "ILB", "QB", "RB", "WR", "LB", "FB", "CB", "TE", "PK", "DT", "DE", "SS", "LS", "FS", "DB", "OG", "OL", "LE", "RE", "KR", "OT", "NT", "RG", "LG", "S", "K", "G" }; if (TflService == null) { LogError("No TFL service available!"); } else { LogTrace("Article Examiner up and running"); } }
private async Task <bool> AreLinesValidAsync(UpdateLinePreferencesViewModel model, CancellationToken cancellationToken) { if (model.FavoriteLines != null) { ITflService service = _tflServiceFactory.CreateService(); ICollection <LineInfo> lines = await service.GetLinesAsync(cancellationToken); IList <string> validLines = lines.Select((p) => p.Id).ToList(); return(model.FavoriteLines.All((p) => validLines.Contains(p))); } return(true); }
public TransactionManager(ITflService tflService) { TflService = tflService; Log = new NLogAdaptor(); ProcessingStrategies = new Dictionary <string, IProcessTransaction> { { "SIGN", new PlayerSigningStrategy(TflService) }, { "TRADE", new PlayerTradingStrategy(TflService) }, { "CUT", new PlayerCutStrategy(TflService) }, { "WAIVER", new PlayerCutStrategy(TflService) }, { "RETIRED", new PlayerRetirementStrategy(TflService) }, { "NEWBIE", new NewbieStrategy(TflService) }, { "INJURY", new PlayerInjuredStrategy(TflService) } }; Log.Trace($@"TransactionManager instantiated with { ProcessingStrategies.Count } strategies" ); }
public PlayerInjuredStrategy(ITflService tflService) { TflService = tflService; }
public PlayerSigningStrategy( ITflService tflService) { TflService = tflService; }
public PlayerTradingStrategy(ITflService tflService) { TflService = tflService; }
public NewbieStrategy(ITflService tflService) { this.tflService = tflService; }
public TransportController(ITflService Service) { _service = Service; }
public PlayerRetirementStrategy(ITflService tflService) { TflService = tflService; }
public PlayerCutStrategy(ITflService tflService) { TflService = tflService; }