public DrawsList HydrateDraws(DrawsList drawsList) { var hydratedDraws = new DrawsList { Draws = new List <Draw>() }; if (drawsList?.Draws.Count > 0 && drawsList.Success) { foreach (var draw in drawsList.Draws) { var newDraw = draw; //For the draws required on the challenge, replace the logoUrl with a local one switch (draw.ProductId) { case "OzLotto": newDraw.DrawLogoUrl = ozLottoLogoUrl; break; case "Powerball": newDraw.DrawLogoUrl = powerballLogoUrl; break; case "TattsLotto": case "GoldLogo": newDraw.DrawLogoUrl = GoldLottoLogoUrl; break; } hydratedDraws.Draws.Add(newDraw); } } return(hydratedDraws); }
public IActionResult Index() { var drawsList = new DrawsList(); drawsList = _lotteryService.GetOpenDrawList(); //If drawsList contains data, hydrate it for the view var hydratedModel = drawsList?.Draws.Count > 0 ? _drawRepository.HydrateDraws(drawsList) : null; return(View(hydratedModel)); }
async Task RefreshData() { try { List <DrawsInfo> draws = await Service.UpdateDrawsList(DrawPage); if (draws.Any()) { DrawsList.Clear(); foreach (var row in draws) { DrawsList.Add(row); } } } catch (Exception exc) { Debug.WriteLine(exc.Message); } }