private async Task <string> UpdateHealthCard(HealthCardUpdateModel healthCardUpdateModel) { var identificationNum = Request.QueryString["identificationNumber"]; var patientToUpdate = await PatientFacade.GetPatientByIdentificationNumberAsync(identificationNum); var healthCard = await HealthCardFacade.GetHealthCardAsync(patientToUpdate.Id); if (healthCard == null) { var healthCardDto = new HealthCardDto { Id = patientToUpdate.Id, LastUpdate = DateTime.Now }; await HealthCardFacade.CreateHealthCardAsync(healthCardDto); healthCard = await HealthCardFacade.GetHealthCardAsync(patientToUpdate.Id); } if (healthCardUpdateModel.BloodType != HospitalISDBContext.Enums.BloodType.Unknown) { healthCard.BloodType = healthCardUpdateModel.BloodType; } if (healthCardUpdateModel.DiseaseId != Guid.Empty) { await MatchDiseaseAndHealthCard(await DiseaseFacade.GetDiseaseAsync(healthCardUpdateModel.DiseaseId), healthCard); } healthCard.LastUpdate = DateTime.Now; await HealthCardFacade.EditHealthCardAsync(healthCard); return(identificationNum); }
public async Task <ActionResult> UnmatchDoctorAndPatient(string identificationNumber) { var patientDto = await PatientFacade.GetPatientByIdentificationNumberAsync(identificationNumber); var doctorDto = await DoctorFacade.GetDoctorByUsernameAsync(HttpContext.User.Identity.Name); var rowId = await DoctorToPatientFacade.FindJoiningRelationshipId(doctorDto.Id, patientDto.Id); await DoctorToPatientFacade.Delete(rowId); return(RedirectToAction("GetPatientsForDoctor", "Doctor", new { Username = HttpContext.User.Identity.Name })); }
public async Task <ActionResult> PatientAskForGetInfoDoctor(string identificationNumber) { var patient = (await PatientFacade.GetPatientByIdentificationNumberAsync(identificationNumber)); return(await GetPatientInfo(patient)); }