public async Task <List <HospitalPatient> > GetHostpialPatientsAsync()
        {
            string query = $@"SELECT * FROM Patients";

            var iterator = _container.GetItemQueryIterator <Model>(query);

            List <Model> matches = new List <Model>();

            while (iterator.HasMoreResults)
            {
                var next = await iterator.ReadNextAsync();

                matches.AddRange(next);
            }

            return(matches.Select(c => HospitalPatient.Create(c.Id, c.FirstName, c.LastName, c.Age, c.DocumentId, c.Photo)).ToList());
        }
Esempio n. 2
0
        public async Task AddAsync(HospitalPatientModel request)
        {
            var fileName = await _blobStorageProvider.UploadFile(request.Photo);

            var hospitalPatient = HospitalPatient.Create(Guid.NewGuid(), request.FirstName, request.LastName, request.Age, request.DocumentId, fileName);

            await _hostpitalPatientRepoistory.AddAsync(hospitalPatient);

            await _azureTableLogger.LogAsync(new LogEntity
            {
                FirstName    = hospitalPatient.FirstName,
                LastName     = hospitalPatient.LastName,
                CreatedOn    = DateTime.Now,
                Message      = "HospitalPatientCreated",
                RowKey       = Guid.NewGuid().ToString(),
                PartitionKey = "Log"
            });
        }