private async Task <IResource> CreateObservation(IResource input)
        {
            var visiBloodPressure = _resourceMapper.MapViSiBloodPressure(input);

            await _visiContext.BloodPressure.AddAsync(visiBloodPressure);

            await _visiContext.SaveChangesAsync();

            // return the new resource as it was stored by this server
            return(_resourceMapper.MapBloodPressure(_visiContext.BloodPressure.Last()));
        }
Example #2
0
        private async Task <SearchResult> SearchObservation(IArgumentCollection arguments, SearchOptions options)
        {
            var query = _queryContext.CreateQuery(new BPQueryFactory(_visiContext), arguments, options);

            var count = await query.ExecuteCount(_visiContext);

            var observationResources = new List <IResource>();

            if (count > 0)
            {
                var visiBloodPressures = await query.Execute(_visiContext).ToListAsync();

                foreach (var visiBloodPressure in visiBloodPressures)
                {
                    observationResources.Add(_resourceMapper.MapBloodPressure(visiBloodPressure));
                }
            }
            return(new SearchResult(observationResources, query.GetPageSize(), count));
        }