コード例 #1
0
        public async Task <IActionResult> PatchDevice([FromRoute] Guid id, [FromBody] DeviceDetailsDto device)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != device.Id)
            {
                return(BadRequest());
            }

            var result = await _service.UpdateDevice(id, _mapper.Map <Device>(device));

            if (result == null)
            {
                BadRequest();
            }

            return(Ok(result));
        }