public async Task AddAsync(HospitalPatient hospitalPatient)
 {
     await _container.CreateItemAsync <Model>(new Model
     {
         Id         = hospitalPatient.Id,
         FirstName  = hospitalPatient.FirstName,
         LastName   = hospitalPatient.LastName,
         DocumentId = hospitalPatient.DocumentId,
         Age        = hospitalPatient.Age,
         CreatedOn  = hospitalPatient.CreatedOn,
         Photo      = hospitalPatient.Photo
     });
 }
        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());
        }
Exemple #3
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"
            });
        }