예제 #1
0
        public async Task <IActionResult> PutPatient(int id, Patient patient)
        {
            if (id != patient.Id)
            {
                return(BadRequest());
            }
            try
            {
                _context.Entry(patient).State = EntityState.Modified;

                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PatientExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutClassificationOfDisease(int id, ClassificationOfDisease classificationOfDisease)
        {
            if (id != classificationOfDisease.Id)
            {
                return(BadRequest());
            }

            _context.Entry(classificationOfDisease).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClassificationOfDiseaseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutProcedure(int id, Procedure procedure)
        {
            if (id != procedure.Id)
            {
                return(BadRequest());
            }

            _context.Entry(procedure).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProcedureExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutToothRecord(int id, ToothRecord toothRecord)
        {
            if (id != toothRecord.Id)
            {
                return(BadRequest());
            }

            _context.Entry(toothRecord).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ToothRecordExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #5
0
        public async Task <IActionResult> PutEncounter(int id, Encounter encounter)
        {
            if (id != encounter.Id)
            {
                return(BadRequest());
            }

            _context.Entry(encounter).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EncounterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <Diagnosis> > PutDiagnosis(int id, Diagnosis diagnosis)
        {
            if (id != diagnosis.Id)
            {
                return(BadRequest());
            }

            _context.Entry(diagnosis).State = EntityState.Modified;

            try
            {
                diagnosis.ToothRecord             = _context.ToothRecords.First(t => t.Id == diagnosis.ToothRecord.Id);
                diagnosis.ClassificationOfDisease = _context.ClassificationOfDiseases.Find(diagnosis.ClassificationOfDisease.Id);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DiagnosisExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(diagnosis);
        }
예제 #7
0
        public async Task <ActionResult <ProcedureRecord> > PutProcedureRecord(int id, ProcedureRecord procedureRecord)
        {
            if (id != procedureRecord.Id)
            {
                return(BadRequest());
            }

            _context.Entry(procedureRecord).State = EntityState.Modified;

            try
            {
                procedureRecord.ToothRecord = _context.ToothRecords.First(t => t.Id == procedureRecord.ToothRecord.Id);
                procedureRecord.Procedure   = _context.Procedures.Find(procedureRecord.Procedure.Id);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProcedureRecordExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(procedureRecord);
        }