public BloodPressureDto PostBloodPressure(BloodPressureDto bloodPressureDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var bloodPressure = Mapper.Map <BloodPressureDto, BloodPressure>(bloodPressureDto); _context.BloodPressure.Add(bloodPressure); _context.SaveChanges(); bloodPressureDto.BloodPressureId = bloodPressure.BloodPressureId; return(bloodPressureDto); }
public void PutBloodPressure(int id, BloodPressureDto bloodPressureDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var bloodPressure = _context.BloodPressure.SingleOrDefault(b => b.BloodPressureId == id); if (bloodPressure == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } Mapper.Map(bloodPressureDto, bloodPressure); _context.SaveChanges(); }
private BloodPressureDto CreateBloodPressureDto(ResultDto systolicBp, ResultDto diastolicBp) { if (systolicBp.ResultType.DisplayName != SystolicBP || diastolicBp.ResultType.DisplayName != DiastolicBP) { return(null); } var bloodPressureDto = new BloodPressureDto(); if (systolicBp != null && systolicBp.ResultValue != null && systolicBp.ResultValue.PhysicalQuantity != null) { bloodPressureDto.SystollicMeasure = GetNullableIntValue(systolicBp.ResultValue.PhysicalQuantity.Value); } if (diastolicBp != null && diastolicBp.ResultValue != null && diastolicBp.ResultValue.PhysicalQuantity != null) { bloodPressureDto.DiastollicMeasure = GetNullableIntValue(diastolicBp.ResultValue.PhysicalQuantity.Value); } return(bloodPressureDto); }
private static void RemoveBloodPressure(BloodPressureDto bloodPressureDto, VitalSign vitalSign, BloodPressure bloodPressure) { vitalSign.RemoveBloodPressure(bloodPressure); }
private static void ChangeBloodPressure(BloodPressureDto bloodPressureDto, VitalSign vitalSign, BloodPressure bloodPressure) { RemoveBloodPressure(bloodPressureDto, vitalSign, bloodPressure); AddBloodPressure(bloodPressureDto, vitalSign); }
private static void AddBloodPressure(BloodPressureDto bloodPressureDto, VitalSign vitalSign) { vitalSign.AddBloodPressure( new BloodPressure(bloodPressureDto.SystollicMeasure.GetValueOrDefault(), bloodPressureDto.DiastollicMeasure.GetValueOrDefault())); }