Exemplo n.º 1
0
        public ActionResult Create(Patient patient)
        {
            if (ModelState.IsValid)
            {

                db.Patients.Add(patient);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(patient);
        }
Exemplo n.º 2
0
        public ActionResult AddPatient(Patient patient)
        {
            int id = int.Parse(Session["ClinicId"].ToString());

            Clinic clinic = db.Clinics.Find(id);
            //var client = new Patient(){Address =  patient.Address, PatientId =  patient.PatientId, EmailAddress = patient.EmailAddress, NextofKinMobile =  patient.NextofKinMobile, Fullname = patient.Fullname, Phonenumber = patient.Phonenumber, Dob = patient.Dob};
            try
            {
                //db.Patients.Add(patient);

                clinic.Patients = new List<Patient>() {patient};
                db.Entry(clinic).State = EntityState.Modified;

                db.SaveChanges();
                return Json("created", JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Source + "-" + ex.Message + "-" + ex.StackTrace + "-" + ex.Data);
            }

            return null;
        }
Exemplo n.º 3
0
 public ActionResult CreatePatient(Patient patient)
 {
     db.Patients.Add(patient);
     db.SaveChanges();
     return Json("created", JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 4
0
 public ActionResult Edit(Patient patient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(patient);
 }