예제 #1
0
        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));
        }
예제 #2
0
        public async Task <IActionResult> UpdatePower([FromBody] PowerDto powerDto)
        {
            await _powerService.UpdatePower(powerDto);

            return(Created(Constants.HTTP_UPDATED, powerDto));
        }