コード例 #1
0
        public async Task CheckCardsAsync()
        {
            IList <StatisticsCardsResponseModel> redCards    = _statiticisServices.GetRedCards();
            IList <StatisticsCardsResponseModel> yellowCards = _statiticisServices.GetYellowCards();
            List <int> ids = new List <int>();

            foreach (var item in redCards)
            {
                if (item.Total >= 1)
                {
                    ids.Add(item.Id);
                }
            }
            foreach (var item in yellowCards)
            {
                if (item.Total >= 5)
                {
                    ids.Add(item.Id);
                }
            }
            if (ids.Any())
            {
                Console.WriteLine("yellow cards or red detected!!");
                await SendHttpClient(ids);
            }
            else
            {
                Console.WriteLine("There are not yellow cards or red cards for now...");
            }
        }
コード例 #2
0
ファイル: StatisticsController.cs プロジェクト: granhal/fxs
 public IActionResult GetYellowCards()
 {
     try
     {
         return(Ok(_services.GetYellowCards()));
     }
     catch (FXSException fxse)
     {
         return(StatusCode(Int32.Parse(fxse.Code), new ExceptionModel {
             Message = fxse.Message, Code = fxse.Code
         }));
     }
     catch (Exception ex)
     {
         return(NotFound(ex.Message));
     }
 }