コード例 #1
0
ファイル: PatientController.cs プロジェクト: KastnerRG/TVCV19
        public async Task <IActionResult> AdmitPatient([FromBody] Patient patientModel)
        {
            patientModel.Id = await _patientRepository.AdmitPatient(patientModel);

            var token = await _roomClient.CreateRoomAsync(new RoomRequest
            {
                Name       = $"{patientModel.Id}",
                Properties = new RoomProperties()
                {
                    OwnerOnlyBroadcast = true
                }
            });

            if (string.IsNullOrWhiteSpace(token))
            {
                _logger.LogWarning($"Unable to create room for patient: {patientModel.Name} id: {patientModel.Id}");
            }
            patientModel.Token           = token;
            patientModel.AdmissionStatus = AdmissionStatus.Admitted;
            await _patientRepository.UpdatePatient(patientModel);

            return(Ok(patientModel));
        }