Exemplo n.º 1
0
 public ActionResult CreateDiseaseRecord(DiseaseRecord diseaseRecord)
 {
     if (ModelState.IsValid)
     {
         if (diseaseRecord.IsOutpatientCatd())
         {
             Patient patient = db.Patients.First(pat => pat.OutpatientCard == diseaseRecord.OutpatientCard);
             patient.Sickness = new List <DiseaseRecord>()
             {
                 diseaseRecord
             };
             return(addDiseaseRecord(patient, diseaseRecord));
         }
         else
         {
             Patient patient = new Patient {
                 OutpatientCard = diseaseRecord.OutpatientCard, Login = diseaseRecord.OutpatientCard, Password = diseaseRecord.OutpatientCard, Name = diseaseRecord.Name
             };
             patient.Sickness = new List <DiseaseRecord>()
             {
                 diseaseRecord
             };
             db.Patients.Add(patient);
             return(addDiseaseRecord(patient, diseaseRecord));
         }
     }
     return(View(new { id = diseaseRecord.DoctorId }));
 }