public async Task <IActionResult> PostDevice([FromBody] DeviceDetailsDto deviceToCreate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var createdDevice = await _service.CreateDevice(_mapper.Map <Device>(deviceToCreate)); return(CreatedAtAction("GetDevice", new { createdDevice.Id }, createdDevice)); }