Пример #1
0
        public async Task <IActionResult> AddAsync(
            [SwaggerParameter(Required = true)] HeroAddOptions heroAddOptions)
        {
            var hero =
                await _heroService.AddAsync(
                    heroAddOptions);

            return(Created("HeroFetchById", hero));
        }
Пример #2
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "heroes")] HttpRequest req,
            ILogger log)
        {
            var heroAddOptions =
                JsonConvert.DeserializeObject <HeroAddOptions>(
                    await new StreamReader(req.Body).ReadToEndAsync());

            var hero =
                await _heroService.AddAsync(
                    heroAddOptions);

            return(new CreatedResult("HeroFetchById", hero));
        }
Пример #3
0
 public async Task <Hero> Post(Hero hero)
 {
     return(await _heroService.AddAsync(hero));
 }