// GET: /DocHospitals/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DocHospital dochospital = db.DocHospitals.Find(id);

            if (dochospital == null)
            {
                return(HttpNotFound());
            }

            string file = Server.MapPath("~/Images/states.json");
            //deserialize JSON from file
            string Json = System.IO.File.ReadAllText(file);
            JavaScriptSerializer ser = new JavaScriptSerializer();
            var personlist           = ser.Deserialize <List <string> >(Json);


            ViewBag.states = personlist;



            return(View(dochospital));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DocHospital dochospital = db.DocHospitals.Find(id);

            db.DocHospitals.Remove(dochospital);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "id,Hospitalname,Hospitaladdress,State,Otherinfo,date,mobile")] DocHospital dochospital)
        {
            if (ModelState.IsValid)
            {
                dochospital.date = DateTime.Now;

                db.Entry(dochospital).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(dochospital));
        }
        public ActionResult Create([Bind(Include = "id,Hospitalname,Hospitaladdress,State,Otherinfo,date,mobile")] DocHospital dochospital)
        {
            if (ModelState.IsValid)
            {
                dochospital.date = DateTime.Now;

                db.DocHospitals.Add(dochospital);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dochospital));
        }
        // GET: /DocHospitals/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DocHospital dochospital = db.DocHospitals.Find(id);

            if (dochospital == null)
            {
                return(HttpNotFound());
            }
            return(View(dochospital));
        }