Ejemplo n.º 1
0
        public IActionResult AddVitalSigns([FromBody] VitalSignsViewModel vitalSigns)
        {
            if (ModelState.IsValid)
            {
                var claim    = HttpContext?.User.Claims.ToArray();
                var username = claim[0].Value.ToString();

                long userDetailsID = context.UserDetails.Where(u => u.Username == username).SingleOrDefault().UserDetailsID;

                var patientId = vitalSigns.PatientID;

                var visitId = context.Visits.Where(v => v.PatientID == patientId)
                              .Where(v => v.Current == 1).FirstOrDefault().VisitId;

                var vitals = new VitalSigns
                {
                    Temperature      = vitalSigns.Temperature,
                    Pulse            = vitalSigns.Pulse,
                    Respiration      = vitalSigns.Respiration,
                    BloodPressure    = vitalSigns.BloodPressure,
                    OxygenSaturation = vitalSigns.OxygenSaturation,
                    Date             = DateTime.Now,
                    UserDetailsID    = userDetailsID,
                    VisitId          = visitId
                };
                context.VitalSigns.Add(vitals);
                context.SaveChanges();

                return(Ok(vitals));
            }
            return(BadRequest());
        }
Ejemplo n.º 2
0
 void VitalSignsView_Loaded(object sender, RoutedEventArgs e)
 {
     this.vitalSignsViewModel = this.DataContext as VitalSignsViewModel;
     this.vitalSignsViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_VitalSignsViewModel_PropertyChanged);
 }