public IHttpActionResult PutPower(int id, PowerDTO powerDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != powerDto.ID) { return(BadRequest()); } if (!powerService.PowerExists(powerDto.ID)) { return(NotFound()); } powerService.UpdatePower(powerDto); return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> UpdatePower([FromBody] PowerDto powerDto) { await _powerService.UpdatePower(powerDto); return(Created(Constants.HTTP_UPDATED, powerDto)); }