コード例 #1
0
        public IActionResult Post(int id, [FromBody] PatientDetailsInput patient)
        {
            bool result = patientRepo.AddNewPatient(id, patient);

            if (result)
            {
                return(Ok());
            }
            return(NotFound());
        }
コード例 #2
0
        public void WhenICUIsFullStatusNotFound()
        {
            PatientDataRepository patientDataRepository = new PatientDataRepository();
            PatientDetailsInput   patientDetailsInput   = new PatientDetailsInput();

            patientDetailsInput.address    = "kolkata";
            patientDetailsInput.age        = 45;
            patientDetailsInput.bloodGroup = "o+";
            patientDetailsInput.name       = "venu";
            var response = patientDataRepository.AddNewPatient(1, patientDetailsInput);

            Assert.AreEqual(false, response);
        }
コード例 #3
0
        public bool AddNewPatient(int icuID, PatientDetailsInput patient)
        {
            int occupancy = ReturnBedNumber(icuID);

            if (occupancy == -1)
            {
                return(false);
            }

            using var cmd   = new SQLiteCommand(con);
            cmd.CommandText = @"INSERT INTO Patient(Name,Age,BloodGroup,Address,BedNumber,IcuId) VALUES('" + patient.name + "','" + patient.age + "','" + patient.bloodGroup + "','" + patient.address + "','" + occupancy + "','" + icuID + "')";
            cmd.ExecuteNonQuery();

            return(true);
        }