public IActionResult Post([FromBody] BedDataModel bedDetails)
 {
     if (bedDetails != null)
     {
         var result = _bedDatabase.AddBed(bedDetails);
         return(Ok(result));
     }
     return(BadRequest("Provide all details to add bed!"));
 }
 public BedDataModel AddBed(BedDataModel bed)
 {
     if (bed != null)
     {
         _context.Beds.Add(bed);
         _context.SaveChanges();
         return(bed);
     }
     return(null);
 }
        public IActionResult GetBedInfo(string id)
        {
            BedDataModel patientInfo = _patientdatabase.BedInfoFromPatientId(id);

            if (patientInfo != null)
            {
                return(Ok(patientInfo));
            }
            return(BadRequest("Patient not found OR Bed information for patient not found!"));
        }
        public BedDataModel RemoveBed(string bedId)
        {
            BedDataModel bed = _context.Beds.Find(bedId);

            if (bed != null)
            {
                _context.Beds.Remove(bed);
                _context.SaveChanges();
            }
            return(bed);
        }
Esempio n. 5
0
        public BedDataModel BedInfoFromPatientId(string patientId)
        {
            PatientDataModel details = _context.Patients.Find(patientId);

            if (details != null)
            {
                BedDataModel bed = _context.Beds.Find(details.BedId);
                return(bed);
            }
            return(null);
        }
        public IActionResult GetBedStatus(string id)
        {
            BedDataModel bedDetails = _bedDatabase.GetBedDetailsById(id);

            if (bedDetails != null)
            {
                bool bedStatus = bedDetails.BedStatus;
                return(Ok(bedStatus));
            }
            return(BadRequest("Bed not found!"));
        }
 public IActionResult Put(string id, [FromBody] BedDataModel bedDetails)
 {
     if (bedDetails.BedId == id)
     {
         var result = _bedDatabase.UpdateBed(bedDetails);
         if (result != null)
         {
             return(Ok(result));
         }
     }
     return(BadRequest("Update operation failed. Bed does not exist!"));
 }
Esempio n. 8
0
        internal static async Task <string> PutBedData(BedDataModel requestObj)
        {
            try
            {
                HttpResponseMessage response = await Client.PutAsJsonAsync("api/BedData/" + requestObj.BedId, requestObj).ConfigureAwait(false);

                return(ConvertHttpResponseToStringResponse(ref response));
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
Esempio n. 9
0
        private void PositionBedAsPerIcuLayout(BedDataModel bedDataModel, int bedNum, int totalNumOfBeds, string layout)
        {
            BedView bed = new BedView(bedDataModel);

            if (layout.Equals("Parallel"))
            {
                PositionBedForParallelLayout(bed, bedNum, totalNumOfBeds);
            }
            else
            {
                PositionBedForLShapeLayout(bed, bedNum, totalNumOfBeds);
            }
        }
Esempio n. 10
0
        public BedViewModel(BedDataModel bed)
        {
            _bedDataModel = bed;

            AlertMessage        = "";
            AlertMessageHistory = "";

            CheckPatientVitalsCommand = new Command.DelegateCommandClass(CheckPatientVitalsWrapper, CanExecuteWrapper);

            DischargePatientCommand = new Command.DelegateCommandClass(DischargePatientWrapper, CanExecuteWrapper);

            StopAlertCommand = new Command.DelegateCommandClass(StopAlertWrapper, CanExecuteWrapper);

            UndoAlertCommand = new Command.DelegateCommandClass(UndoAlertWrapper, CanExecuteWrapper);
        }
        public BedDataModel UpdateBed(BedDataModel bedDetailsChanges)
        {
            string id = bedDetailsChanges.BedId;

            if (_context.Beds.Find(id) != null)
            {
                BedDataModel bed = _context.Beds.Find(id);
                if (bed != null)
                {
                    bed.BedStatus = bedDetailsChanges.BedStatus;
                    bed.PatientId = bedDetailsChanges.PatientId;
                    bed.IcuId     = bedDetailsChanges.IcuId;
                    _context.SaveChanges();
                }
                return(bed);
            }
            return(null);
        }
        public BedDataModel GetBedDetailsById(string bedId)
        {
            BedDataModel bedDetails = _context.Beds.Find(bedId);

            return(bedDetails);
        }
Esempio n. 13
0
 public BedView(BedDataModel bed)
 {
     InitializeComponent();
     DataContext = new BedViewModel(bed);
 }
 public BedDataViewModel()
 {
     bedDataModel       = new BedDataModel();
     RegisterBedCommand = new Commands.Command(RegisterBed, CanRegister);
     UpdateBedCommand   = new Commands.Command(UpdateBedDetails, CanUpdate);
 }