예제 #1
0
        public void GetTodayComicTest()
        {
            WebComicService svc      = new WebComicService();
            var             response = svc.GetTodayComic(TODAY_COMIC_URL).Result;

            Assert.IsTrue(response.Success);
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            //get data from remote using comic service
            var response = await _service.GetTodayComic(GeneralSettings.Instance.TodayComicUrl);


            if (response.Success)
            {
                var model = response.GetData <WebComic>();

                _logger.LogInformation($"Getting remote resource is completed!. Sending Data to User -> Comic:{model.Num} {(model.IsTodayComic?"-> Is Today's Comic":"")}");
                return(View(model));
            }
            else
            {
                //write info into log
                _logger.LogInformation($"Response Status: {response.StatusCode}. Comic Resource was not found! Redirect to {1} Comic.");

                //Redirect to next or previous comic resource
                return(RedirectToAction("Comic", new { code = 1 }));
            }
        }