Ejemplo n.º 1
0
        public async Task Run()
        {
            try
            {
                var response = await _httpClient.GetAsync("http://mohajertc.ir/StudentReserveFood.aspx?Language=Fa&Status=Students&lr=lang_fa");

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    _htmlDocument.LoadHtml(await response.Content.ReadAsStringAsync());

                    _foods = new List <Food>(_foodRepository.CurrentWeekFoods());

                    await SendForm(_foods, "0");

                    CheckResult();

                    await GoToNextWeek(_foods);

                    _foods = new List <Food>(_foodRepository.NextWeekFoods());

                    await SendForm(_foods, "1");

                    CheckResult();
                }
            }
            catch (Exception)
            {
                _reserveLogRepository.Insert(_logs.Values.ToArray());
            }
        }