Пример #1
0
 public PatientsController(
     IPatientApi patientApi,
     IMapper mapper)
 {
     this.patientApi = patientApi;
     this.mapper     = mapper;
 }
Пример #2
0
        public CreateConsultationRequestValidator(
            IClinicApi clinicApi,
            IPatientApi patientApi)
        {
            RuleFor(x => x.ClinicId)
            .NotEmpty()
            .WithMessage("Provide ClinicId")
            .MustAsync(async(clinicId, cancellationToken) =>
            {
                var clinic = await clinicApi.GetClinic(clinicId);
                if (!clinic.IsSuccessStatusCode)
                {
                    return(false);
                }

                return(true);
            })
            .WithMessage("Clinic does not exists");

            RuleFor(x => x.PatientId)
            .NotEmpty()
            .WithMessage("Provide PatientId")
            .MustAsync(async(patientId, cancellationToken) =>
            {
                var patient = await patientApi.GetPatient(patientId);
                if (!patient.IsSuccessStatusCode)
                {
                    return(false);
                }

                return(true);
            })
            .WithMessage("Patient does not exists");
        }
 public ConsultationsController(
     IConsultationApi consultationApi,
     IMapper mapper,
     IClinicApi clinicApi,
     IPatientApi patientApi)
 {
     this.consultationApi = consultationApi;
     this.mapper          = mapper;
     this.clinicApi       = clinicApi;
     this.patientApi      = patientApi;
 }
 public AppointmentsController(
     IAppointmentApi appointmentApi,
     IConsultationApi consultationApi,
     IClinicApi clinicApi,
     IPatientApi patientApi,
     IMapper mapper
     )
 {
     this.appointmentApi  = appointmentApi;
     this.consultationApi = consultationApi;
     this.clinicApi       = clinicApi;
     this.patientApi      = patientApi;
     this.mapper          = mapper;
 }
Пример #5
0
        static ApiCoordinator()
        {
            userSettings      = Locator.Current.GetService <ISettingsRepository>();
            sharedPreferences = Locator.Current.GetService <ISharedPreferences>();

            Func <long, Task> saveTime = (long time) => {
                return(Task.Run(() => sharedPreferences.SetLong(PreferencesKeys.LAST_REQUEST, time)));
            };

            var httpClient = new HttpClient(new CustomHttpClientHandler(GetToken, saveTime))
            {
                BaseAddress = new Uri(SERVER_URL)
            };

            loginApi   = RestService.For <ILoginApi>(httpClient);
            chatApi    = RestService.For <IChatApi>(httpClient);
            userApi    = RestService.For <IUserApi>(httpClient);
            patientApi = RestService.For <IPatientApi>(httpClient);
        }