public ActionResult checkdetails(checkdetailsviewmodel mod)
        {
            int r = 0;
            int k = 0;
            list_pat_details            list = new list_pat_details();
            hospital_managementEntities db   = new hospital_managementEntities();
            Patient_Prescription        R    = db.Patient_Prescription.Find(mod.PatientId);
            Patient_History             K    = db.Patient_History.Find(mod.PatientId);

            foreach (Patient_Prescription p in db.Patient_Prescription)
            {
                if (p.Registerid == mod.PatientId)
                {
                    r = 1;
                }
            }
            foreach (Patient_History p in db.Patient_History)
            {
                if (p.patient_id == mod.PatientId)
                {
                    k = 1;
                }
            }

            if (r == 0 && k == 0)
            {
                return(HttpNotFound());
            }

            /*else
             * {
             *
             *  Addprescriptionviewmodel S = new Addprescriptionviewmodel();
             *  Addhistoryviewmodel Q = new Addhistoryviewmodel();
             *
             *
             *  S.PatientId = mod.PatientId;
             *  S.Medicine = R.Medicine;
             *  S.Duration = R.Duration;
             *  S.Morning = R.Noon;
             *  S.Evening = R.Evening;
             *  S.Morning = R.Morning;
             *  Q.Gender = K.Gender;
             *  Q.Age = K.Age;
             *  Q.BP = K.BP;
             *  Q.Weight = K.Weight;
             *  Q.Pulse = K.Pulse;
             *  Q.indications = K.indications;
             *  Q.PatientId = mod.PatientId;
             *  list.list_history.Add(Q);
             *
             *  list.list_prescription.Add(S);
             *
             * }*/
            else
            {
                return(RedirectToAction("checkdetailslist", new { id = mod.PatientId }));
            }
        }
        public ActionResult checkdetailslist(int id)
        {
            int r = 0;
            int k = 0;
            list_pat_details            list = new list_pat_details();
            hospital_managementEntities db   = new hospital_managementEntities();

            foreach (Patient_Prescription p in db.Patient_Prescription)
            {
                if (p.Registerid == id)
                {
                    r = 1;
                }
            }
            foreach (Patient_History p in db.Patient_History)
            {
                if (p.patient_id == id)
                {
                    k = 1;
                }
            }



            if (r == 0 && k == 0)
            {
                return(HttpNotFound());
            }
            else
            {
                Addprescriptionviewmodel S = new Addprescriptionviewmodel();
                Addhistoryviewmodel      Q = new Addhistoryviewmodel();



                foreach (Patient_Prescription p in db.Patient_Prescription)
                {
                    if (p.Registerid == id)
                    {
                        S.Duration  = p.Duration;
                        S.Evening   = p.Evening;
                        S.Medicine  = p.Medicine;
                        S.Morning   = p.Morning;
                        S.Noon      = p.Noon;
                        S.id        = p.SR;
                        S.PatientId = p.Registerid;
                    }
                }
                foreach (Patient_History p in db.Patient_History)
                {
                    if (p.patient_id == id)
                    {
                        Q.Age         = p.Age;
                        Q.BP          = p.BP;
                        Q.Gender      = p.Gender;
                        Q.indications = p.indications;
                        Q.PatientId   = p.patient_id;
                        Q.Pulse       = p.Pulse;
                        Q.id          = p.id;
                        Q.Weight      = p.Weight;
                    }
                }

                list.list_history.Add(Q);
                list.list_prescription.Add(S);
            }

            return(View(list));

            /*else
             * {
             *
             *  Addprescriptionviewmodel S = new Addprescriptionviewmodel();
             *  Addhistoryviewmodel Q = new Addhistoryviewmodel();
             *
             *
             *  S.PatientId = mod.PatientId;
             *  S.Medicine = R.Medicine;
             *  S.Duration = R.Duration;
             *  S.Morning = R.Noon;
             *  S.Evening = R.Evening;
             *  S.Morning = R.Morning;
             *  Q.Gender = K.Gender;
             *  Q.Age = K.Age;
             *  Q.BP = K.BP;
             *  Q.Weight = K.Weight;
             *  Q.Pulse = K.Pulse;
             *  Q.indications = K.indications;
             *  Q.PatientId = mod.PatientId;
             *  list.list_history.Add(Q);
             *
             *  list.list_prescription.Add(S);
             *
             * }*/
        }