public async Task <Guid> Create(DoctorToPatientDto doctorToPatientDto) { using (var uow = UnitOfWorkProvider.Create()) { var guid = doctorToPatientService.Create(doctorToPatientDto.DoctorDto.Id, doctorToPatientDto.PatientDto.Id); await uow.Commit(); return(guid); } }
public async Task <ActionResult> AddClickedPatient() { var username = Request.QueryString["Username"]; var foundPatient = await PatientFacade.GetPatientByUsernameAsync(username); var loggedDoctor = await DoctorFacade.GetDoctorByUsernameAsync(HttpContext.User.Identity.Name); var relationshipGuid = await DoctorToPatientFacade.FindJoiningRelationshipId(loggedDoctor.Id, foundPatient.Id); if (relationshipGuid == Guid.Empty) { var doctorToPatientDto = new DoctorToPatientDto { DoctorDto = loggedDoctor, PatientDto = foundPatient }; await DoctorToPatientFacade.Create(doctorToPatientDto); } return(RedirectToAction("GetPatientsForDoctor", "Doctor", new { Username = loggedDoctor.Username })); }