Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var result = await _fortunes.RandomFortuneAsync();

            ViewData["fortune"] = result.Text;
            return(View());
        }
Exemplo n.º 2
0
        protected override async Task <Fortune> RunAsync()
        {
            var result = await _fortuneService.RandomFortuneAsync();

            _logger.LogInformation("Run: {0}", result);
            return(result);
        }
        public async Task OnGet()
        {
            var fortune = await _fortunes.RandomFortuneAsync();

            Message = fortune.Text;
            HttpContext.Session.Set("MyFortune", Encoding.ASCII.GetBytes(Message));
        }
Exemplo n.º 4
0
        public async Task <string> Random()
        {
            _logger?.LogInformation("Random");
            var result = await _fortunes.RandomFortuneAsync();

            _logger?.LogInformation("Random returning: " + result);
            return(result);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> RandomFortune()
        {
            _logger?.LogDebug("RandomFortune");

            var fortune = await _fortuneService.RandomFortuneAsync();

            HttpContext.Session.SetString("MyFortune", fortune?.Text);
            return(View(fortune));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> RandomFortune()
        {
            _logger?.LogDebug("RandomFortune");

            // Lab05 Start
            var fortune = await _fortunes.RandomFortuneAsync();

            // Lab05 End

            HttpContext.Session.SetString("MyFortune", fortune.Text);
            return(View(fortune));
        }
Exemplo n.º 7
0
 public async Task <string> Random()
 {
     return(await _fortunes.RandomFortuneAsync());
 }
Exemplo n.º 8
0
 public async Task <string> Random()
 {
     _logger?.LogInformation("Random");
     return(await _fortunes.RandomFortuneAsync());
 }
        public async Task <string> GoProductAsync([FromServices] IFortuneService service)
        {
            var a = "test'";

            return(await service.RandomFortuneAsync());
        }
Exemplo n.º 10
0
 protected override async Task <Fortune> RunAsync()
 {
     return(await _fortuneService.RandomFortuneAsync());
 }
        public async Task <JsonResult> Random()
        {
            var fortune = await _fortunes.RandomFortuneAsync();

            return(Json(fortune, JsonRequestBehavior.AllowGet));
        }