public IActionResult Register([FromBody] RegisterViewModel formData) { IActionResult actionResult; var result = _register.Register(formData); if (result.IsError) { actionResult = Conflict(result); } else { actionResult = Ok(result); } return(actionResult); }
private void btnRegister_Click(object sender, EventArgs e) { btnRegister.Enabled = false; //绑定模型 RegisterModel _registerModel = new RegisterModel { CardNo = txtCardNo.Text, Name = txtName.Text, IDCard = txtIDCard.Text, PinYin = txtPinyin1.Text, Gender = cmbGender.SelectedValue.ToString(), GenderName = cmbGender.Text, Address = txtAddress.Text, BirthDay = txtBirthDay.Text, CurrentAge = txtAge.Text, Phone = txtPhone.Text, PostCode = txtPostCode.Text, Email = txtEmail.Text, ImageNumber = txtImageNumber.Text, PatientType = cmbPatientType.Text, VisitType = cmbVisitType.Text, CheckNo = txtCheckNo.Text, BillHospital = txtBillHospital.Text, ApplyDept = cmbApplyDept.SelectedValue.ToString(), ApplyDeptName = cmbApplyDept.Text, ApplyDocter = txtApplyDocterCode.Text, ApplyDocterName = txtApplyDocter.Text, Area = txtArea.Text, Bed = txtBed.Text, ApplyDate = dtpApplyDate.Value, CheckDept = cmbCheckDept.SelectedValue.ToString(), CheckDeptName = cmbCheckDept.Text, CheckType = cmbCheckType.Text, Equipment = cmbEquipment.Text, Position = cmbPosition.Text, Method = cmbMethod.Text, Symptom = txtSymptom.Text, Diagnosis = txtDiagnosis.Text, DockerAsk = txtRemarks.Text, RequestID = lblRequestID.Text, Projects = dgvApplys.DataSource as List <ApplyItem>, }; if (_registerBll.Register(_registerModel, out string errorMsg)) { tabControl1.SelectedTab = tabPage1; lblRequestID.Text = null; tabPage2.Parent = null; dgvApplyBills.DataSource = null; dgvApplyProjects.DataSource = null; dgvApplys.DataSource = null; patient = new PatientInfo(); Rest(); RestTextBox(); MessageBox.Show("添加成功."); } else { MessageBox.Show(errorMsg); } btnRegister.Enabled = true; }