Beispiel #1
0
        public ActionResult EditMedicationRequest([Bind] EditMedicationRequest request, string patientID)
        {
            bool   status  = false;
            string Message = "";

            //SPRAWDZENIE DANYCH
            if (ModelState.IsValid)
            {
                //PODŁĄCZENIE KLIENTA
                var client = new FhirClient("http://localhost:8080/baseR4");
                client.PreferredFormat = ResourceFormat.Json;

                //PRZEKAZANIE DANYCH
                MedicationRequest original = client.Read <MedicationRequest>("MedicationRequest/" + request.ID);
                (original.Medication as CodeableConcept).Text = request.Reason;
                Dosage dosage = new Dosage();
                dosage.Text = request.Instruction;
                original.DosageInstruction.Add(dosage);

                //UPDATE
                client.Update(original);
                Message = "Your item successfully UPDATE";
                status  = true;
            }
            else
            {
                Message = "You haven't got right model";
            }

            ViewBag.ID      = patientID;
            ViewBag.Status  = status;
            ViewBag.Message = Message;
            return(View(request));
        }
Beispiel #2
0
        public ActionResult EditMedicationRequest(string id, string type, string patientID)
        {
            //POŁĄCZENIE Z KLIENTEM
            var client = new FhirClient("http://localhost:8080/baseR4");

            client.PreferredFormat = ResourceFormat.Json;
            ViewBag.ID             = patientID;

            if (type == "MedicationRequest")
            {
                //WYSZUKANIE ZASOBU
                MedicationRequest     request  = client.Read <MedicationRequest>("MedicationRequest/" + id);
                EditMedicationRequest mrequest = new EditMedicationRequest();

                //PRZEKAZANIE DANYCH
                mrequest.Reason = (request.Medication as CodeableConcept).Text;
                if (request.DosageInstruction.Count() > 0)
                {
                    mrequest.Instruction = request.DosageInstruction[0].Text;
                }
                else
                {
                    mrequest.Instruction = "";
                }
                mrequest.ID = request.Id;
                return(View(mrequest));
            }

            ViewBag.Message = "Some Error until Redirect";
            return(View());
        }