Example #1
0
        public IHttpActionResult PostPower(PowerDTO powerDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var newPower = powerService.AddPower(powerDto);

            return(CreatedAtRoute("DefaultApi", new { id = newPower.ID }, newPower));
        }
Example #2
0
 public async Task <IActionResult> AddTeam(AddPowerDto newPower)
 {
     return(Ok(await _powerService.AddPower(newPower)));
 }
        public async Task <IHttpActionResult> Post([FromBody] PowerViewModel power)
        {
            var newPower = await Task.Run(() => _powerService.AddPower(power));

            return(CreatedAtRoute("GetPowerById", new { id = newPower.Id }, newPower));
        }