public async Task <IActionResult> AddAsync( [SwaggerParameter(Required = true)] HeroAddOptions heroAddOptions) { var hero = await _heroService.AddAsync( heroAddOptions); return(Created("HeroFetchById", hero)); }
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)); }
public async Task <Hero> Post(Hero hero) { return(await _heroService.AddAsync(hero)); }