Ejemplo n.º 1
0
        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            this.ViewData["Greeting"] = greetingService.SayHello();

            return(View());
        }
Ejemplo n.º 2
0
        public string GetGreeting()
        {
            IGreetingService service1 = greetingFactory.Create(GreetingType.EMILY);
            IGreetingService service2 = greetingFactory.Create(GreetingType.JOHN);
            IGreetingService service3 = greetingFactory.Create(GreetingType.JOSHUA);
            StringBuilder    sb       = new StringBuilder();

            sb.Append(service1.SayHello() + "\n");
            sb.Append(service2.SayHello() + "\n");
            sb.Append(service3.SayHello());
            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string name = req.Query["name"];

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            name = name ?? data?.name;

            return(name != null
                ? (ActionResult) new OkObjectResult(_greetingService.SayHello(name))
                : new BadRequestObjectResult("Please pass a name on the query string or in the request body"));
        }
Ejemplo n.º 4
0
        public IActionResult Index()
        {
            var content = _greetingService.SayHello();

            return(Content(content));
        }