Example #1
0
        static void addPatients(DbContext db)
        {
            var patient = new Patient () {
                FirstName = "Bubba", LastName = "Ho-Tep", Age = 1234, PersonalNumber = "1111111231234"
            };
            db.Patients.Add (patient);
            db.SaveChanges ();

            var incident = new Incident()
            {
                InjuryDate = "2010-03-04",
                InjuryHour = 9,
                PersonalNumber = patient.PersonalNumber
            };
            db.Incidents.Add(incident);

            var frac1 = new Fracture()
            {
                AOCode = "33C2",
                IncidentID = incident.ID
            };
            db.Fractures.Add(frac1);

            var frac2 = new Fracture()
            {
                AOCode = "22B1",
                IncidentID = incident.ID
            };
            db.Fractures.Add(frac2);

            var consultation = new Consultation();
            db.Consultations.Add(consultation);

            var procedure = new Procedure() {
                // ConsultationID = consultation.ID,
                FractureID = frac1.ID
            };
            db.Procedures.Add(procedure);

            procedure = new Procedure()
            {
                // ConsultationID = consultation.ID,
                FractureID = frac2.ID
            };
            db.Procedures.Add(procedure);

            //patient = new Patient () {
            //    FirstName = "Joe", LastName = "Schmoe", Age = 35
            //};
            //db.Patients.Add (patient);
            //db.SaveChanges ();

            //injury = new Injury () {
            //    AOCode = "31B2",
            //    InjuryDate = new DateTime (2002, 8, 5),
            //    InjuryHour = 23,
            //    PatientID=patient.ID
            //};
            //db.Injuries.Add (injury);
        }
Example #2
0
        public HttpStatusCode Index(string id)
        {
            var patient = new Patient () { PersonalNumber = id };
            db.Patients.Attach (patient);
            db.Patients.Remove (patient);
            try {
                db.SaveChanges ();
            } catch (System.Data.DataException) {
                return HttpStatusCode.NotFound;
            }

            return HttpStatusCode.OK;
        }
Example #3
0
        public ActionResult Index(Patient patient)
        {
            if (ModelState.IsValid)
            {
                db.Patients.Add(patient);
                db.SaveChanges();

                return Json (patient);
            }

            // TODO: Is this the right thing to return?
            return new HttpStatusCodeResult(
                HttpStatusCode.InternalServerError);
        }