Пример #1
0
        public async Task <IEnumerable <Practice> > GetPracticesAsync()
        {
            var qf = new QueryFactory();
            var q  = qf.Create <PracticeEntity>();

            using (var adapter = AdapterFactory.CreateAdapter(_connectionString, "DEVTEST"))
            {
                var practiceEntities = await adapter.FetchQueryAsync(q);

                var practices = new List <Practice>();
                foreach (PracticeEntity practice in practiceEntities)
                {
                    practices.Add(new Practice(practice));
                }

                return(practices);
            }
        }
Пример #2
0
        public async Task <IEnumerable <ClinicDto> > GetClinicsAsync(Guid practicePk)
        {
            var qf = new QueryFactory();
            var q  = qf.Create <ClinicEntity>()
                     .Where(ClinicFields.PracticePk.Equal(practicePk));

            using (var adapter = AdapterFactory.CreateAdapter(_connectionString, _environment))
            {
                var results = await adapter.FetchQueryAsync <ClinicEntity>(q);

                var clinics = new List <ClinicDto>();

                foreach (ClinicEntity clinic in results)
                {
                    clinics.Add(new ClinicDto()
                    {
                        ClinicName = clinic.Name,
                        ClinicPk   = clinic.ClinicPk,
                        PracticePk = clinic.PracticePk
                    });
                }
                return(clinics);
            }
        }